summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/nadvice.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/nadvice.el')
-rw-r--r--lisp/emacs-lisp/nadvice.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 9e058f3c60e..b7c2dab0980 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -4,7 +4,6 @@
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords: extensions, lisp, tools
-;; Package: emacs
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -36,18 +35,23 @@
;;; Code:
+;; The autoloads.el mechanism which adds package--builtin-versions
+;; maintenance to loaddefs.el doesn't work for preloaded packages (such
+;; as this one), so we have to do it by hand!
+(push (purecopy '(nadvice 1 0)) package--builtin-versions)
+
;;;; Lightweight advice/hook
(defvar advice--where-alist
'((:around "\300\301\302\003#\207" 5)
(:before "\300\301\002\"\210\300\302\002\"\207" 4)
(:after "\300\302\002\"\300\301\003\"\210\207" 5)
- (:override "\300\301\"\207" 4)
+ (:override "\300\301\002\"\207" 4)
(:after-until "\300\302\002\"\206\013\000\300\301\002\"\207" 4)
(:after-while "\300\302\002\"\205\013\000\300\301\002\"\207" 4)
(:before-until "\300\301\002\"\206\013\000\300\302\002\"\207" 4)
(:before-while "\300\301\002\"\205\013\000\300\302\002\"\207" 4)
- (:filter-args "\300\302\301!\"\207" 5)
- (:filter-return "\301\300\302\"!\207" 5))
+ (:filter-args "\300\302\301\003!\"\207" 5)
+ (:filter-return "\301\300\302\003\"!\207" 5))
"List of descriptions of how to add a function.
Each element has the form (WHERE BYTECODE STACK) where:
WHERE is a keyword indicating where the function is added.
@@ -83,8 +87,9 @@ Each element has the form (WHERE BYTECODE STACK) where:
"Build the raw docstring for FUNCTION, presumably advised."
(let* ((flist (indirect-function function))
(docfun nil)
+ (macrop (eq 'macro (car-safe flist)))
(docstring nil))
- (if (eq 'macro (car-safe flist)) (setq flist (cdr flist)))
+ (if macrop (setq flist (cdr flist)))
(while (advice--p flist)
(let ((doc (aref flist 4))
(where (advice--where flist)))
@@ -96,10 +101,11 @@ Each element has the form (WHERE BYTECODE STACK) where:
(setq docstring
(concat
docstring
- (propertize (format "%s advice: " where)
- 'face 'warning)
+ (format "This %s has %s advice: "
+ (if macrop "macro" "function")
+ where)
(let ((fun (advice--car flist)))
- (if (symbolp fun) (format-message "`%S'" fun)
+ (if (symbolp fun) (format-message "`%S'." fun)
(let* ((name (cdr (assq 'name (advice--props flist))))
(doc (documentation fun t))
(usage (help-split-fundoc doc function)))
@@ -241,6 +247,8 @@ different, but `function-equal' will hopefully ignore those differences.")
(if (local-variable-p var) (symbol-value var)
(setq advice--buffer-local-function-sample
;; This function acts like the t special value in buffer-local hooks.
+ ;; FIXME: Provide an `advice-bottom' function that's like
+ ;; `advice-cd*r' but also follows through this proxy.
(lambda (&rest args) (apply (default-value var) args)))))
(eval-and-compile