X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a749f1c648f2b9bf1a0b0b10e2da4c1c4e3d431d..652b638b0f80fda2abc316f3d1b0f005c7d28e1a:/lisp/emacs-lisp/nadvice.el diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index faebe26904..1b30499bf1 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -1,6 +1,6 @@ ;;; nadvice.el --- Light-weight advice primitives for Elisp functions -*- lexical-binding: t -*- -;; Copyright (C) 2012-2015 Free Software Foundation, Inc. +;; Copyright (C) 2012-2016 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: extensions, lisp, tools @@ -95,7 +95,7 @@ Each element has the form (WHERE BYTECODE STACK) where: (propertize (format "%s advice: " where) 'face 'warning) (let ((fun (advice--car flist))) - (if (symbolp fun) (format "`%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))) @@ -114,7 +114,10 @@ Each element has the form (WHERE BYTECODE STACK) where: (usage (help-split-fundoc origdoc function))) (setq usage (if (null usage) (let ((arglist (help-function-arglist flist))) - (format "%S" (help-make-usage function arglist))) + ;; "[Arg list not available until function + ;; definition is loaded]", bug#21299 + (if (stringp arglist) t + (help--make-usage-docstring function arglist))) (setq origdoc (cdr usage)) (car usage))) (help-add-fundoc-usage (concat docstring origdoc) usage)))) @@ -279,7 +282,7 @@ a special meaning: whereas a depth of -100 means that the advice should be outermost. If PLACE is a symbol, its `default-value' will be affected. -Use (local 'SYMBOL) if you want to apply FUNCTION to SYMBOL buffer-locally. +Use (local \\='SYMBOL) if you want to apply FUNCTION to SYMBOL buffer-locally. Use (var VAR) if you want to apply FUNCTION to the (lexical) VAR. If one of FUNCTION or OLDFUN is interactive, then the resulting function @@ -289,7 +292,10 @@ is also interactive. There are 3 cases: argument (the interactive spec of OLDFUN, which it can pass to `advice-eval-interactive-spec') and return the list of arguments to use. - Else, use the interactive spec of FUNCTION and ignore the one of OLDFUN." - (declare (debug t)) ;;(indent 2) + (declare + ;;(indent 2) + (debug (form [&or symbolp ("local" form) ("var" sexp) gv-place] + form &optional form))) `(advice--add-function ,where (gv-ref ,(advice--normalize-place place)) ,function ,props)) @@ -311,7 +317,8 @@ is also interactive. There are 3 cases: If FUNCTION was not added to PLACE, do nothing. Instead of FUNCTION being the actual function, it can also be the `name' of the piece of advice." - (declare (debug t)) + (declare (debug ([&or symbolp ("local" form) ("var" sexp) gv-place] + form))) (gv-letplace (getter setter) (advice--normalize-place place) (macroexp-let2 nil new `(advice--remove-function ,getter ,function) `(unless (eq ,new ,getter) ,(funcall setter new))))) @@ -522,8 +529,9 @@ of the piece of advice." (while (progn (funcall get-next-frame) - (not (and (eq (nth 1 frame2) 'apply) - (eq (nth 3 frame2) inneradvice))))) + (and frame2 + (not (and (eq (nth 1 frame2) 'apply) + (eq (nth 3 frame2) inneradvice)))))) (funcall get-next-frame) (funcall get-next-frame)))) (- i origi 1))))