1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(describe-function-1): Find source of advised functions.

This commit is contained in:
Richard M. Stallman 2007-10-14 22:49:39 +00:00
parent 15975e3514
commit 72a2003200
2 changed files with 31 additions and 5 deletions

View file

@ -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