Function: help-fns-function-description-header
help-fns-function-description-header is a byte-compiled function
defined in help-fns.el.gz.
Signature
(help-fns-function-description-header FUNCTION)
Documentation
Print a line describing FUNCTION to standard-output.
Source Code
;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns-function-description-header (function)
"Print a line describing FUNCTION to `standard-output'."
(pcase-let* ((`(,_real-function ,def ,aliased ,real-def)
(help-fns--analyze-function function))
(file-name (find-lisp-object-file-name function (if aliased 'defun
def)))
(beg (if (and (or (byte-code-function-p def)
(keymapp def)
(memq (car-safe def) '(macro lambda closure)))
(stringp file-name)
(help-fns--autoloaded-p function file-name))
(concat
"an autoloaded " (if (commandp def)
"interactive "))
(if (commandp def) "an interactive " "a "))))
;; Print what kind of function-like object FUNCTION is.
(princ (cond ((or (stringp def) (vectorp def))
"a keyboard macro")
((and (symbolp function)
(get function 'reader-construct))
"a reader construct")
;; Aliases are Lisp functions, so we need to check
;; aliases before functions.
(aliased
(format-message "an alias for `%s'" real-def))
((subr-native-elisp-p def)
(concat beg "native-compiled Lisp function"))
((subrp def)
(concat beg (if (eq 'unevalled (cdr (subr-arity def)))
"special form"
"built-in function")))
((autoloadp def)
(format "an autoloaded %s"
(cond
((commandp def) "interactive Lisp function")
((eq (nth 4 def) 'keymap) "keymap")
((nth 4 def) "Lisp macro")
(t "Lisp function"))))
((or (eq (car-safe def) 'macro)
;; For advised macros, def is a lambda
;; expression or a byte-code-function-p, so we
;; need to check macros before functions.
(macrop function))
(concat beg "Lisp macro"))
((byte-code-function-p def)
(concat beg "byte-compiled Lisp function"))
((module-function-p def)
(concat beg "module function"))
((eq (car-safe def) 'lambda)
(concat beg "Lisp function"))
((eq (car-safe def) 'closure)
(concat beg "Lisp closure"))
((keymapp def)
(let ((is-full nil)
(elts (cdr-safe def)))
(while elts
(if (char-table-p (car-safe elts))
(setq is-full t
elts nil))
(setq elts (cdr-safe elts)))
(concat beg (if is-full "keymap" "sparse keymap"))))
(t "")))
(if (and aliased (not (fboundp real-def)))
(princ ",\nwhich is not defined.")
(with-current-buffer standard-output
(save-excursion
(save-match-data
(when (re-search-backward (substitute-command-keys
"alias for `\\([^`']+\\)'")
nil t)
(help-xref-button 1 'help-function real-def)))))
(if (not file-name)
(with-current-buffer standard-output
(setq help-mode--current-data (list :symbol function)))
;; We used to add .el to the file name,
;; but that's completely wrong when the user used load-file.
(princ (format-message " in `%s'"
(if (eq file-name 'C-source)
"C source code"
(help-fns-short-filename file-name))))
;; Make a hyperlink to the library.
(with-current-buffer standard-output
(setq help-mode--current-data (list :symbol function
:file file-name))
(save-excursion
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'")
nil t)
(help-xref-button 1 'help-function-def function file-name))))
(princ "."))))