changeset 27550:85fc4786dfde

(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.
author Dave Love <fx@gnu.org>
date Tue, 01 Feb 2000 14:12:00 +0000
parents 352104f4b2fb
children 2dd8115a9f72
files lisp/help.el
diffstat 1 files changed, 99 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Tue Feb 01 10:03:58 2000 +0000
+++ b/lisp/help.el	Tue Feb 01 14:12:00 2000 +0000
@@ -693,21 +693,41 @@
 			  (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 @@
            (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