aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2016-10-03 18:49:56 -0400
committerNoam Postavsky2016-10-21 22:39:37 -0400
commit9da53e2d353c97ab955fe8c35482b5eb335316c1 (patch)
treec2765fbfffffec106172529c8832a9dd860fcb24
parent5c2da93015abb2e6746d54e5946dfaa5ede4e685 (diff)
downloademacs-9da53e2d353c97ab955fe8c35482b5eb335316c1.tar.gz
emacs-9da53e2d353c97ab955fe8c35482b5eb335316c1.zip
Let describe-function work for lambda again
Since commit "* lisp/help-fns.el (describe-function): More type checking[...]", `describe-function' throws a user-error when given a non-symbol. This prevents the [back] button in a *Help* buffer from working when the page it goes back to describes an anonymous function (e.g., the result of `describe-key' on a key which is bound to a lambda form). * lisp/help-fns.el (describe-function): Move the checks on FUNCTION being an fbound symbol into the `interactive' form. This allows non-interactive calls to pass an anonymous function (Bug #24221). Note that passing a non-bound symbol non-interactively will still trigger a `void-function' error from `describe-function-1'.
-rw-r--r--lisp/help-fns.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 26d8839f7cb..7dfa6700b29 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -50,23 +50,24 @@ to get buffer-local values.")
50 50
51;;;###autoload 51;;;###autoload
52(defun describe-function (function) 52(defun describe-function (function)
53 "Display the full documentation of FUNCTION (a symbol)." 53 "Display the full documentation of FUNCTION (a symbol).
54When called from lisp, FUNCTION may also be a function object."
54 (interactive 55 (interactive
55 (let ((fn (function-called-at-point)) 56 (let* ((fn (function-called-at-point))
56 (enable-recursive-minibuffers t) 57 (enable-recursive-minibuffers t)
57 val) 58 (val (completing-read
58 (setq val (completing-read (if fn 59 (if fn
59 (format "Describe function (default %s): " fn) 60 (format "Describe function (default %s): " fn)
60 "Describe function: ") 61 "Describe function: ")
61 obarray 'fboundp t nil nil 62 obarray 'fboundp t nil nil
62 (and fn (symbol-name fn)))) 63 (and fn (symbol-name fn)))))
63 (list (if (equal val "") 64 (unless (equal val "")
64 fn (intern val))))) 65 (setq fn (intern val)))
65 (or (and function (symbolp function)) 66 (unless (and fn (symbolp fn))
66 (user-error "You didn't specify a function symbol")) 67 (user-error "You didn't specify a function symbol"))
67 (or (fboundp function) 68 (unless (fboundp fn)
68 (user-error "Symbol's function definition is void: %s" function)) 69 (user-error "Symbol's function definition is void: %s" fn))
69 70 (list fn)))
70 ;; We save describe-function-orig-buffer on the help xref stack, so 71 ;; We save describe-function-orig-buffer on the help xref stack, so
71 ;; it is restored by the back/forward buttons. 'help-buffer' 72 ;; it is restored by the back/forward buttons. 'help-buffer'
72 ;; expects (current-buffer) to be a help buffer when processing 73 ;; expects (current-buffer) to be a help buffer when processing