]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/help-fns.el (help-C-file-name): Handle advised functions.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 2 Feb 2014 02:25:05 +0000 (21:25 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 2 Feb 2014 02:25:05 +0000 (21:25 -0500)
* lisp/emacs-lisp/find-func.el (find-function-C-source): Idem.
* lisp/emacs-lisp/nadvice.el (advice--cd*r): New function.
* help-fns.el (describe-function-1): Use it.

Fixes: debbugs:16478
lisp/ChangeLog
lisp/emacs-lisp/find-func.el
lisp/emacs-lisp/nadvice.el
lisp/help-fns.el

index 11952ba98ee75eb82fc91ce368624413b0147358..6471005cf8d9b22c66bb375b68b0eaf6e6b8e4a7 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * help-fns.el (help-C-file-name): Handle advised functions (bug#16478).
+       * emacs-lisp/find-func.el (find-function-C-source): Idem.
+       * emacs-lisp/nadvice.el (advice--cd*r): New function.
+       * help-fns.el (describe-function-1): Use it.
+
 2014-02-02  Glenn Morris  <rgm@gnu.org>
 
        * register.el (register-preview-default): New function,
@@ -35,8 +42,8 @@
        (ruby-smie-grammar): Make "." right-associative.  Make its priority
        lower than the ternary and all binary operators.
        (ruby-smie-rules): Indent "(" relative to the first non-"."
-       parent, or the first "." parent at indentation.  Use
-       `ruby-align-chained-calls' for indentation of "." tokens.
+       parent, or the first "." parent at indentation.
+       Use `ruby-align-chained-calls' for indentation of "." tokens.
        (Bug#16593)
 
 2014-01-31  Juri Linkov  <juri@jurta.org>
index 31e9be81034aa58a254885f18f9d5d065a1913a5..5c404ce04684fe85768fb0139131f5a86e38fa60 100644 (file)
@@ -219,7 +219,7 @@ TYPE should be nil to find a function, or `defvar' to find a variable."
                         (regexp-quote (symbol-name fun-or-var))
                         "\"")
               (concat "DEFUN[ \t\n]*([ \t\n]*\""
-                      (regexp-quote (subr-name fun-or-var))
+                      (regexp-quote (subr-name (advice--cd*r fun-or-var)))
                       "\""))
             nil t)
       (error "Can't find source for %s" fun-or-var))
index 3dfeb04a9b3f9401591735e73c98951fa44bc602..8dc1f19784c1e7fe34b49414181a382fd62710c4 100644 (file)
@@ -67,6 +67,11 @@ Each element has the form (WHERE BYTECODE STACK) where:
 (defsubst advice--cdr   (f) (aref (aref f 2) 2))
 (defsubst advice--props (f) (aref (aref f 2) 3))
 
+(defun advice--cd*r (f)
+  (while (advice--p f)
+    (setq f (advice--cdr f)))
+  f)
+
 (defun advice--make-docstring (function)
   "Build the raw docstring for FUNCTION, presumably advised."
   (let ((flist (indirect-function function))
index 2252c700feadc5beccb7cecb9b05051927de7de5..5e38de88f72bfa5099ab5f5acd61efe20c9d71d5 100644 (file)
@@ -187,7 +187,7 @@ KIND should be `var' for a variable or `subr' for a subroutine."
   (let ((docbuf (get-buffer-create " *DOC*"))
        (name (if (eq 'var kind)
                  (concat "V" (symbol-name subr-or-var))
-               (concat "F" (subr-name subr-or-var)))))
+               (concat "F" (subr-name (advice--cd*r subr-or-var))))))
     (with-current-buffer docbuf
       (goto-char (point-min))
       (if (eobp)
@@ -542,11 +542,7 @@ FILE is the file where FUNCTION was probably defined."
         ;; real definition, if that symbol is already set up.
         (real-function
          (or (and advised
-                  (let* ((advised-fn (advice--cdr
-                                      (advice--symbol-function function))))
-                    (while (advice--p advised-fn)
-                      (setq advised-fn (advice--cdr advised-fn)))
-                    advised-fn))
+                   (advice--cd*r (advice--symbol-function function)))
              function))
         ;; Get the real definition.
         (def (if (symbolp real-function)
@@ -660,9 +656,9 @@ FILE is the file where FUNCTION was probably defined."
                   (or doc "Not documented.")))))))
 
 ;; Add defaults to `help-fns-describe-function-functions'.
-(add-hook 'help-fns-describe-function-functions 'help-fns--obsolete)
-(add-hook 'help-fns-describe-function-functions 'help-fns--parent-mode)
-(add-hook 'help-fns-describe-function-functions 'help-fns--compiler-macro)
+(add-hook 'help-fns-describe-function-functions #'help-fns--obsolete)
+(add-hook 'help-fns-describe-function-functions #'help-fns--parent-mode)
+(add-hook 'help-fns-describe-function-functions #'help-fns--compiler-macro)
 
 \f
 ;; Variables