;;; nadvice.el --- Light-weight advice primitives for Elisp functions -*- lexical-binding: t -*-
-;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2016 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords: extensions, lisp, tools
(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)))
(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))))
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
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))
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)))))
(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))))