[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111014: * lisp/emacs-lisp/advice.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111014: * lisp/emacs-lisp/advice.el (ad-should-compile): Don't compile advice if the |
Date: |
Mon, 26 Nov 2012 14:56:14 -0500 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111014
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12965
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-11-26 14:56:14 -0500
message:
* lisp/emacs-lisp/advice.el (ad-should-compile): Don't compile advice if the
base function is not yet defined.
(ad-activate-advised-definition): Use ad-compile-function.
(ad-activate): Use cond.
modified:
lisp/ChangeLog
lisp/emacs-lisp/advice.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-11-25 16:07:58 +0000
+++ b/lisp/ChangeLog 2012-11-26 19:56:14 +0000
@@ -1,3 +1,10 @@
+2012-11-26 Stefan Monnier <address@hidden>
+
+ * emacs-lisp/advice.el (ad-should-compile): Don't compile advice if the
+ base function is not yet defined (bug#12965).
+ (ad-activate-advised-definition): Use ad-compile-function.
+ (ad-activate): Use cond.
+
2012-11-25 Leo Liu <address@hidden>
* textmodes/sgml-mode.el (sgml-tag): Fix indentation for closing tag.
@@ -10,14 +17,14 @@
Texinfo integration.
* textmodes/reftex.el (reftex-section-pre-regexp)
- (reftex-section-post-regexp, reftex-section-info-function): New
- variable.
- (reftex-compile-variables): Use variables
- reftex-section-pre-regexp, reftex-section-post-regexp, and
- reftex-section-info-function in order to be compatible with Texinfo
integration.
+ (reftex-section-post-regexp, reftex-section-info-function):
+ New variable.
+ (reftex-compile-variables): Use variables reftex-section-pre-regexp,
+ reftex-section-post-regexp, and reftex-section-info-function in order
+ to be compatible with Texinfo integration.
- * textmodes/reftex-toc.el (reftex-toc-promote-action): use
- reftex-section-pre-regexp variable in order to be compatible with
+ * textmodes/reftex-toc.el (reftex-toc-promote-action):
+ use reftex-section-pre-regexp variable in order to be compatible with
Texinfo integration.
2012-11-25 Chong Yidong <address@hidden>
=== modified file 'lisp/emacs-lisp/advice.el'
--- a/lisp/emacs-lisp/advice.el 2012-11-16 18:02:39 +0000
+++ b/lisp/emacs-lisp/advice.el 2012-11-26 19:56:14 +0000
@@ -2900,19 +2900,18 @@
If COMPILE is a negative number then it returns nil.
If COMPILE is nil then the result depends on the value of
`ad-default-compilation-action' (which see)."
- (if (integerp compile)
- (>= compile 0)
- (if compile
- compile
- (cond ((eq ad-default-compilation-action 'never)
- nil)
- ((eq ad-default-compilation-action 'always)
- t)
- ((eq ad-default-compilation-action 'like-original)
- (or (ad-subr-p (ad-get-orig-definition function))
- (ad-compiled-p (ad-get-orig-definition function))))
- ;; everything else means `maybe':
- (t (featurep 'byte-compile))))))
+ (cond
+ ;; Don't compile until the real function definition is known (bug#12965).
+ ((not (ad-real-orig-definition function)) nil)
+ ((integerp compile) (>= compile 0))
+ (compile)
+ ((eq ad-default-compilation-action 'never) nil)
+ ((eq ad-default-compilation-action 'always) t)
+ ((eq ad-default-compilation-action 'like-original)
+ (or (ad-subr-p (ad-get-orig-definition function))
+ (ad-compiled-p (ad-get-orig-definition function))))
+ ;; everything else means `maybe':
+ (t (featurep 'byte-compile))))
(defun ad-activate-advised-definition (function compile)
"Redefine FUNCTION with its advised definition from cache or scratch.
@@ -2927,7 +2926,7 @@
(ad-make-advised-definition function)))
(advice-add function :around advicefunname)
(if (ad-should-compile function compile)
- (byte-compile advicefunname))
+ (ad-compile-function function))
(if verified-cached-definition
(if (not (eq verified-cached-definition
(symbol-function advicefunname)))
@@ -3003,20 +3002,20 @@
(interactive
(list (ad-read-advised-function "Activate advice of")
current-prefix-arg))
- (if (not (ad-is-advised function))
- (error "ad-activate: `%s' is not advised" function)
- ;; Just return for forward advised and not yet defined functions:
- (if (ad-get-orig-definition function)
- (if (not (ad-has-any-advice function))
- (ad-unadvise function)
- ;; Otherwise activate the advice:
- (cond ((ad-has-redefining-advice function)
- (ad-activate-advised-definition function compile)
- (ad-set-advice-info-field function 'active t)
- (eval (ad-make-hook-form function 'activation))
- function)
- ;; Here we are if we have all disabled advices:
- (t (ad-deactivate function)))))))
+ (cond
+ ((not (ad-is-advised function))
+ (error "ad-activate: `%s' is not advised" function))
+ ;; Just return for forward advised and not yet defined functions:
+ ((not (ad-get-orig-definition function)) nil)
+ ((not (ad-has-any-advice function)) (ad-unadvise function))
+ ;; Otherwise activate the advice:
+ ((ad-has-redefining-advice function)
+ (ad-activate-advised-definition function compile)
+ (ad-set-advice-info-field function 'active t)
+ (eval (ad-make-hook-form function 'activation))
+ function)
+ ;; Here we are if we have all disabled advices:
+ (t (ad-deactivate function))))
(defalias 'ad-activate-on 'ad-activate)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111014: * lisp/emacs-lisp/advice.el (ad-should-compile): Don't compile advice if the,
Stefan Monnier <=