[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116729: * lisp/emacs-lisp/nadvice.el (advice--make-
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r116729: * lisp/emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance. |
Date: |
Tue, 11 Mar 2014 01:22:31 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116729
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2014-03-10 21:22:24 -0400
message:
* lisp/emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance.
(advice-add): Add a :advice--pending marker, so advice--make-1 knows
when the advice is pending.
(advice-remove): Remove this marker when not needed any more.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/emacs-lisp/nadvice.el nadvice.el-20121015213644-851fdxs2vximj8nr-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-03-11 00:46:07 +0000
+++ b/lisp/ChangeLog 2014-03-11 01:22:24 +0000
@@ -1,3 +1,10 @@
+2014-03-11 Stefan Monnier <address@hidden>
+
+ * emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance.
+ (advice-add): Add a :advice--pending marker, so advice--make-1 knows
+ when the advice is pending.
+ (advice-remove): Remove this marker when not needed any more.
+
2014-03-11 Juanma Barranquero <address@hidden>
* frameset.el: Separate options for reusing frames and cleaning up.
=== modified file 'lisp/emacs-lisp/nadvice.el'
--- a/lisp/emacs-lisp/nadvice.el 2014-02-02 02:25:05 +0000
+++ b/lisp/emacs-lisp/nadvice.el 2014-03-11 01:22:24 +0000
@@ -141,11 +141,12 @@
(let ((adv-sig (gethash main advertised-signature-table))
(advice
(apply #'make-byte-code 128 byte-code
- (vector #'apply function main props) stack-depth
- nil
+ (vector #'apply function main props) stack-depth nil
(and (or (commandp function) (commandp main))
- (not (and (symbolp main) ;; Don't autoload too eagerly!
- (autoloadp (symbol-function main))))
+ ;; If we're adding the advice on advice--pending, don't
+ ;; build an interactive-form, which won't be used anyway
+ ;; and would risk autoloading `main' (or `function').
+ (not (eq main :advice--pending))
(list (advice--make-interactive-form
function main))))))
(when adv-sig (puthash advice adv-sig advertised-signature-table))
@@ -392,6 +393,8 @@
;; - `autoload' does nothing if the function is
;; not an autoload or undefined.
((or (not nf) (autoloadp nf))
+ (unless (get symbol 'advice--pending)
+ (put symbol 'advice--pending :advice--pending))
(get symbol 'advice--pending))
(t (symbol-function symbol)))
function props)
@@ -416,6 +419,8 @@
function)
(unless (advice--p (advice--symbol-function symbol))
;; Not advised any more.
+ (when (eq (get symbol 'advice--pending) :advice--pending)
+ (put symbol 'advice--pending nil))
(remove-function (get symbol 'defalias-fset-function)
#'advice--defalias-fset)
(let ((asr (get symbol 'advice--saved-rewrite)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116729: * lisp/emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance.,
Stefan Monnier <=