summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2007-10-14 22:49:39 +0000
committerRichard M. Stallman <rms@gnu.org>2007-10-14 22:49:39 +0000
commit72a200320042d793f427c63b36a2a9be8bd0390b (patch)
tree817de06c4e978a2816bfd3ab1ac43de9bd14c041 /lisp/help-fns.el
parent15975e3514ed442cec07954afec1c5f247f5f147 (diff)
downloademacs-72a200320042d793f427c63b36a2a9be8bd0390b.tar.gz
(describe-function-1): Find source of advised functions.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index eee0794b673..bf8d5f9a209 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -251,8 +251,15 @@ face (according to `face-differs-from-default-p')."
;;;###autoload
(defun describe-function-1 (function)
- (let* ((def (if (symbolp function)
- (symbol-function function)
+ (let* ((advised (and (featurep 'advice) (ad-get-advice-info function)))
+ ;; If the function is advised, get the symbol that has the
+ ;; real definition.
+ (real-function
+ (if advised (cdr (assq 'origname advised))
+ function))
+ ;; Get the real definition.
+ (def (if (symbolp real-function)
+ (symbol-function real-function)
function))
file-name string
(beg (if (commandp def) "an interactive " "a ")))
@@ -334,7 +341,7 @@ face (according to `face-differs-from-default-p')."
(with-current-buffer standard-output
(save-excursion
(re-search-backward "`\\([^`']+\\)'" nil t)
- (help-xref-button 1 'help-function-def function file-name))))
+ (help-xref-button 1 'help-function-def real-function file-name))))
(princ ".")
(terpri)
(when (commandp function)
@@ -383,8 +390,9 @@ face (according to `face-differs-from-default-p')."
((listp arglist)
(format "%S" (help-make-usage function arglist)))
((stringp arglist) arglist)
- ;; Maybe the arglist is in the docstring of the alias.
- ((let ((fun function))
+ ;; Maybe the arglist is in the docstring of a symbol
+ ;; this one is aliased to.
+ ((let ((fun real-function))
(while (and (symbolp fun)
(setq fun (symbol-function fun))
(not (setq usage (help-split-fundoc