summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2017-10-20 16:04:02 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2017-10-20 16:04:02 -0400
commite1d42f8f4a945669ff8b5159a569cb4b18f56e18 (patch)
treeb1dd489a32be51feb7bf52f0480c192531de5b4f /lisp/help-fns.el
parent900ede244c886c56579dcbfabd04cf4f144275a1 (diff)
downloademacs-e1d42f8f4a945669ff8b5159a569cb4b18f56e18.tar.gz
emacs-e1d42f8f4a945669ff8b5159a569cb4b18f56e18.tar.bz2
emacs-e1d42f8f4a945669ff8b5159a569cb4b18f56e18.zip
* lisp/help-fns.el (describe-function-1): Fix help-fns-test-dangling-alias.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el28
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 788c03e9bf5..e509ce6e2a8 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -561,6 +561,8 @@ FILE is the file where FUNCTION was probably defined."
short))
(defun help-fns--analyse-function (function)
+ ;; FIXME: Document/explain the differences between FUNCTION,
+ ;; REAL-FUNCTION, DEF, and REAL-DEF.
"Return information about FUNCTION.
Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(let* ((advised (and (symbolp function)
@@ -689,10 +691,15 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(point))))
(terpri)(terpri)
- (pcase-let ((`(,real-function ,def ,_aliased ,real-def)
- (help-fns--analyse-function function))
- (doc-raw (documentation function t))
- (key-bindings-buffer (current-buffer)))
+ (pcase-let* ((`(,real-function ,def ,_aliased ,real-def)
+ (help-fns--analyse-function function))
+ (doc-raw (condition-case nil
+ ;; FIXME: Maybe `documentation' should return nil
+ ;; for invalid functions i.s.o. signaling an error.
+ (documentation function t)
+ ;; E.g. an alias for a not yet defined function.
+ (invalid-function nil)))
+ (key-bindings-buffer (current-buffer)))
;; If the function is autoloaded, and its docstring has
;; key substitution constructs, load the library.
@@ -703,10 +710,15 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(help-fns--key-bindings function)
(with-current-buffer standard-output
- (let ((doc (help-fns--signature
- function doc-raw
- (if (subrp def) (indirect-function real-def) real-def)
- real-function key-bindings-buffer)))
+ (let ((doc (condition-case nil
+ ;; FIXME: Maybe `help-fns--signature' should return `doc'
+ ;; for invalid functions i.s.o. signaling an error.
+ (help-fns--signature
+ function doc-raw
+ (if (subrp def) (indirect-function real-def) real-def)
+ real-function key-bindings-buffer)
+ ;; E.g. an alias for a not yet defined function.
+ (invalid-function doc-raw))))
(run-hook-with-args 'help-fns-describe-function-functions function)
(insert "\n" (or doc "Not documented.")))
(when (or (function-get function 'pure)