Function: help-fns--describe-function-or-command-prompt
help-fns--describe-function-or-command-prompt is a byte-compiled
function defined in help-fns.el.gz.
Signature
(help-fns--describe-function-or-command-prompt &optional WANT-COMMAND)
Documentation
Prompt for a function from describe-function or describe-command.
If optional argument WANT-COMMAND is non-nil, prompt for an interactive command.
Source Code
;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns--describe-function-or-command-prompt (&optional want-command)
"Prompt for a function from `describe-function' or `describe-command'.
If optional argument WANT-COMMAND is non-nil, prompt for an
interactive command."
(let* ((fn (if want-command
(caar command-history)
(function-called-at-point)))
(prompt (format-prompt (if want-command
"Describe command"
"Describe function")
fn))
(enable-recursive-minibuffers t)
(val (completing-read
prompt
#'help--symbol-completion-table
(lambda (f) (if want-command
(commandp f)
(or (fboundp f) (get f 'function-documentation))))
;; We used `confirm' for a while because we may want to see the
;; meta-info about a function even if the function itself is not
;; defined, but this use case is too marginal and rarely tested,
;; not worth the trouble (bug#64902).
t nil nil
(and fn (symbol-name fn)))))
(unless (equal val "")
(setq fn (intern val)))
;; These error messages are intended to be less technical for the
;; `describe-command' case, as they are directed at users that are
;; not necessarily ELisp programmers.
(unless (and fn (symbolp fn))
(user-error (if want-command
"You didn't specify a command's symbol"
"You didn't specify a function symbol")))
(unless (or (fboundp fn) (get fn 'function-documentation))
(user-error (if want-command
"Symbol is not a command: %s"
"Symbol's function definition is void: %s")
fn))
(list fn)))