mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-06 20:49:33 +00:00
(describe-function-1): Print note about arglist of autoloaded
functions. Move arglist of primitives up from end of doc string. (help-manyarg-func-alist): Populate it.
This commit is contained in:
parent
968e00f06d
commit
f0d0fb1990
109
lisp/help.el
109
lisp/help.el
@ -693,21 +693,41 @@ It can also be nil, if the definition is not associated with any file."
|
||||
(car (append def nil)))
|
||||
((eq (car-safe def) 'lambda)
|
||||
(nth 1 def))
|
||||
((and (eq (car-safe def) 'autoload)
|
||||
(not (eq (nth 4 def) 'keymap)))
|
||||
(concat "[Arg list not available until "
|
||||
"function definition is loaded.]"))
|
||||
(t t))))
|
||||
(if (listp arglist)
|
||||
(progn
|
||||
(princ (cons (if (symbolp function) function "anonymous")
|
||||
(mapcar (lambda (arg)
|
||||
(if (memq arg '(&optional &rest))
|
||||
arg
|
||||
(intern (upcase (symbol-name arg)))))
|
||||
arglist)))
|
||||
(terpri))))
|
||||
(cond ((listp arglist)
|
||||
(princ (cons (if (symbolp function) function "anonymous")
|
||||
(mapcar (lambda (arg)
|
||||
(if (memq arg '(&optional &rest))
|
||||
arg
|
||||
(intern (upcase (symbol-name arg)))))
|
||||
arglist)))
|
||||
(terpri))
|
||||
((stringp arglist)
|
||||
(princ arglist)
|
||||
(terpri))))
|
||||
(let ((doc (documentation function)))
|
||||
(if doc
|
||||
(progn (terpri)
|
||||
(princ doc)
|
||||
(help-setup-xref (list #'describe-function function) interactive-p))
|
||||
(with-current-buffer standard-output
|
||||
(beginning-of-line)
|
||||
;; Builtins get the calling sequence at the end of
|
||||
;; the doc string. Move it to the same place as
|
||||
;; for other functions.
|
||||
(when (looking-at (format "(%S[ )]" function))
|
||||
(let ((start (point-marker)))
|
||||
(goto-char (point-min))
|
||||
(forward-paragraph)
|
||||
(insert-buffer-substring (current-buffer) start)
|
||||
(insert ?\n)
|
||||
(delete-region (1- start) (point-max))
|
||||
(goto-char (point-max)))))
|
||||
(help-setup-xref (list #'describe-function function)
|
||||
interactive-p))
|
||||
(princ "not documented")))))
|
||||
|
||||
(defun variable-at-point ()
|
||||
@ -1290,4 +1310,73 @@ out of view."
|
||||
(new-height (max (min text-height max-height) min-height)))
|
||||
(enlarge-window (- new-height win-height)))))
|
||||
|
||||
;; `help-manyarg-func-alist' is defined primitively (in doc.c).
|
||||
;; New primitives with `MANY' or `UNEVALLED' arglists should be added
|
||||
;; to this alist.
|
||||
;; The parens and function name are redundant, but it's messy to add
|
||||
;; them in `documentation'.
|
||||
(defconst help-manyarg-func-alist
|
||||
(purecopy
|
||||
'((list . "(list &rest OBJECTS)")
|
||||
(vector . "(vector &rest OBJECTS)")
|
||||
(make-byte-code . "(make-byte-code &rest ELEMENTS)")
|
||||
(call-process
|
||||
. "(call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)")
|
||||
(string . "(string &rest CHARACTERS)")
|
||||
(+ . "(+ &rest NUMBERS-OR-MARKERS)")
|
||||
(- . "(- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS)")
|
||||
(* . "(* &rest NUMBERS-OR-MARKERS)")
|
||||
(/ . "(/ DIVIDEND DIVISOR &rest DIVISORS)")
|
||||
(max . "(max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)")
|
||||
(min . "(min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)")
|
||||
(logand . "(logand &rest INTS-OR-MARKERS)")
|
||||
(logior . "(logior &rest INTS-OR-MARKERS)")
|
||||
(logxor . "(logxor &rest INTS-OR-MARKERS)")
|
||||
(encode-time
|
||||
. "(encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)")
|
||||
(insert . "(insert &rest ARGS)")
|
||||
(insert-before-markers . "(insert-before-markers &rest ARGS)")
|
||||
(message . "(message STRING &rest ARGUMENTS)")
|
||||
(message-box . "(message-box STRING &rest ARGUMENTS)")
|
||||
(message-or-box . "(message-or-box STRING &rest ARGUMENTS)")
|
||||
(propertize . "(propertize STRING &rest PROPERTIES)")
|
||||
(format . "(format STRING &rest OBJECTS)")
|
||||
(apply . "(apply FUNCTION &rest ARGUMENTS)")
|
||||
(run-hooks . "(run-hooks &rest HOOKS)")
|
||||
(funcall . "(funcall FUNCTION &rest ARGUMENTS)")
|
||||
(append . "(append &rest SEQUENCES)")
|
||||
(concat . "(concat &rest SEQUENCES)")
|
||||
(vconcat . "(vconcat vconcat)")
|
||||
(nconc . "(nconc &rest LISTS)")
|
||||
(widget-apply . "(widget-apply WIDGET PROPERTY &rest ARGS)")
|
||||
(make-hash-table . "(make-hash-table &rest KEYWORD-ARGS)")
|
||||
(insert-string . "(insert-string &rest ARGS)")
|
||||
(start-process . "(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)")
|
||||
(setq-default . "(setq-default SYMBOL VALUE [SYMBOL VALUE...])")
|
||||
(save-excursion . "(save-excursion &rest BODY)")
|
||||
(save-current-buffer . "(save-current-buffer &rest BODY)")
|
||||
(save-restriction . "(save-restriction &rest BODY)")
|
||||
(or . "(or CONDITIONS ...)")
|
||||
(and . "(and CONDITIONS ...)")
|
||||
(if . "(if COND THEN ELSE...)")
|
||||
(cond . "(cond CLAUSES...)")
|
||||
(progn . "(progn BODY ...)")
|
||||
(prog1 . "(prog1 FIRST BODY...)")
|
||||
(prog2 . "(prog2 X Y BODY...)")
|
||||
(setq . "(setq SYM VAL SYM VAL ...)")
|
||||
(quote . "(quote ARG)")
|
||||
(function . "(function ARG)")
|
||||
(defun . "(defun NAME ARGLIST [DOCSTRING] BODY...)")
|
||||
(defmacro . "(defmacro NAME ARGLIST [DOCSTRING] BODY...)")
|
||||
(defvar . "(defvar SYMBOL [INITVALUE DOCSTRING])")
|
||||
(defconst . "(defconst SYMBOL INITVALUE [DOCSTRING])")
|
||||
(let* . "(let* VARLIST BODY...)")
|
||||
(let . "(let VARLIST BODY...)")
|
||||
(while . "(while TEST BODY...)")
|
||||
(catch . "(catch TAG BODY...)")
|
||||
(unwind-protect . "(unwind-protect BODYFORM UNWINDFORMS...)")
|
||||
(condition-case . "(condition-case VAR BODYFORM HANDLERS...)")
|
||||
(track-mouse . "(track-mouse BOFY ...)")
|
||||
(ml-if . "(ml-if COND THEN ELSE...)"))))
|
||||
|
||||
;;; help.el ends here
|
||||
|
Loading…
x
Reference in New Issue
Block a user