diff options
| -rw-r--r-- | lisp/emacs-lisp/nadvice.el | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index cd80df2c41d..ce5467f3c5c 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el | |||
| @@ -292,14 +292,13 @@ HOW is a symbol to select an entry in `advice--how-alist'." | |||
| 292 | (equal function (cdr (assq 'name props)))) | 292 | (equal function (cdr (assq 'name props)))) |
| 293 | (list (advice--remove-function rest function))))))) | 293 | (list (advice--remove-function rest function))))))) |
| 294 | 294 | ||
| 295 | (defvar advice--buffer-local-function-sample nil | 295 | (oclosure-define (advice--forward |
| 296 | "Keeps an example of the special \"run the default value\" functions. | 296 | (:predicate advice--forward-p)) |
| 297 | These functions play the same role as t in buffer-local hooks, and to recognize | 297 | "Redirect to the global value of a var. |
| 298 | them, we keep a sample here against which to compare. Each instance is | 298 | These functions act like the t special value in buffer-local hooks.") |
| 299 | different, but `function-equal' will hopefully ignore those differences.") | ||
| 300 | 299 | ||
| 301 | (defun advice--set-buffer-local (var val) | 300 | (defun advice--set-buffer-local (var val) |
| 302 | (if (function-equal val advice--buffer-local-function-sample) | 301 | (if (advice--forward-p val) |
| 303 | (kill-local-variable var) | 302 | (kill-local-variable var) |
| 304 | (set (make-local-variable var) val))) | 303 | (set (make-local-variable var) val))) |
| 305 | 304 | ||
| @@ -308,11 +307,10 @@ different, but `function-equal' will hopefully ignore those differences.") | |||
| 308 | "Buffer-local value of VAR, presumed to contain a function." | 307 | "Buffer-local value of VAR, presumed to contain a function." |
| 309 | (declare (gv-setter advice--set-buffer-local)) | 308 | (declare (gv-setter advice--set-buffer-local)) |
| 310 | (if (local-variable-p var) (symbol-value var) | 309 | (if (local-variable-p var) (symbol-value var) |
| 311 | (setq advice--buffer-local-function-sample | 310 | ;; FIXME: Provide an `advice-bottom' function that's like |
| 312 | ;; This function acts like the t special value in buffer-local hooks. | 311 | ;; `advice--cd*r' but also follows through this proxy. |
| 313 | ;; FIXME: Provide an `advice-bottom' function that's like | 312 | (oclosure-lambda (advice--forward) (&rest args) |
| 314 | ;; `advice-cd*r' but also follows through this proxy. | 313 | (apply (default-value var) args)))) |
| 315 | (lambda (&rest args) (apply (default-value var) args))))) | ||
| 316 | 314 | ||
| 317 | (eval-and-compile | 315 | (eval-and-compile |
| 318 | (defun advice--normalize-place (place) | 316 | (defun advice--normalize-place (place) |