Commit 70e5a261 authored by Stefan Monnier's avatar Stefan Monnier

* lisp/help-fns.el (help-C-file-name): Handle advised functions.

* 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
parent 65bc4bb5
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>
......
......@@ -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))
......
......@@ -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))
......
......@@ -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)
;; Variables
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment