# HG changeset patch # User Richard M. Stallman # Date 1192402078 0 # Node ID 6830ce7af289303f9f93c899e2ab8d873c853619 # Parent bc8b741390b0d43379143b4f6fa468b8ecabd040 (describe-function-1): Find source of advised functions. diff -r bc8b741390b0 -r 6830ce7af289 lisp/help-fns.el --- a/lisp/help-fns.el Sun Oct 14 22:46:38 2007 +0000 +++ b/lisp/help-fns.el Sun Oct 14 22:47:58 2007 +0000 @@ -251,8 +251,15 @@ ;;;###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 @@ (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 @@ ((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