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 (functionp def)
(keymapp def)
(eq (car-safe def) 'macro))
(stringp file-name)
(help-fns--autoloaded-p function))
(concat
"an autoloaded " (if (commandp def)
"interactive "))
(if (commandp def) "an interactive " "a ")))
;; Print what kind of function-like object FUNCTION is.
(description
(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))
((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 compiled-function-p, so we
;; need to check macros before functions.
(macrop function))
(concat beg "Lisp macro"))
((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
(let* ((type (or (oclosure-type def) (cl-type-of def)))
(typ-str
(format "%s"
(if (and (consp def) (symbolp (car def)))
(car def)
(make-text-button
(symbol-name type) nil
'type 'help-type
'help-args (list type))))))
;; FIXME: If someday Emacs has a function type symbol
;; like `unicode-function' or `hour-function', this
;; will produce an ungrammatical string (bug#79469).
(concat (if (string-match-p "\\`[aeiou]" (symbol-name type))
"an "
beg)
typ-str))))))
(with-current-buffer standard-output
(insert description))
(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 "`\\([^`']+\\)'"))
(help-xref-button 1 'help-function-def function file-name))))
(princ "."))))