Function: help-fns--signature
help-fns--signature is a byte-compiled function defined in
help-fns.el.gz.
Signature
(help-fns--signature FUNCTION DOC REAL-DEF REAL-FUNCTION BUFFER)
Documentation
Insert usage at point and return docstring. With highlighting.
Source Code
;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns--signature (function doc real-def real-function buffer)
"Insert usage at point and return docstring. With highlighting."
(if (keymapp function)
doc ; If definition is a keymap, skip arglist note.
(let* ((advertised (get-advertised-calling-convention real-def))
(arglist (if (listp advertised)
advertised (help-function-arglist real-def)))
(usage (help-split-fundoc doc function)))
(if usage (setq doc (cdr usage)))
(let* ((use (cond
((and usage (not (listp advertised))) (car usage))
((listp arglist)
(help--make-usage-docstring function arglist))
((stringp arglist) arglist)
;; Maybe the arglist is in the docstring of a symbol
;; this one is aliased to.
((let ((fun real-function))
(while (and (symbolp fun)
(setq fun (symbol-function fun))
(not (setq usage (help-split-fundoc
(documentation fun)
function)))))
usage)
(car usage))
((or (stringp real-def)
(vectorp real-def))
(format "\nMacro: %s"
(help--docstring-quote
(format-kbd-macro real-def))))
(t "[Missing arglist.]")))
;; Insert "`X", not "(\` X)", when documenting `X.
(use1 (replace-regexp-in-string
"\\`(\\\\=\\\\\\\\=` \\([^\n ]*\\))\\'"
"\\\\=`\\1" use t))
(high (if buffer
(let (subst-use1 subst-doc)
(with-current-buffer buffer
(setq subst-use1 (substitute-command-keys use1))
(setq subst-doc (substitute-command-keys doc)))
(help-highlight-arguments subst-use1 subst-doc))
(cons use1 doc))))
(let ((fill-begin (point))
(high-usage (car high))
(high-doc (cdr high)))
(unless (and (symbolp function)
(get function 'reader-construct))
(insert high-usage "\n")
(when-let* ((gate help-display-function-type)
(res (comp-function-type-spec function))
(type-spec (car res))
(kind (cdr res)))
(insert (format
(if (eq kind 'inferred)
"\nInferred type: %s\n"
"\nDeclared type: %s\n")
type-spec))))
(fill-region fill-begin (point))
high-doc)))))