diff options
| -rw-r--r-- | lisp/help.el | 109 |
1 files changed, 99 insertions, 10 deletions
diff --git a/lisp/help.el b/lisp/help.el index a38d6214829..4beca0a8ecd 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -693,21 +693,41 @@ It can also be nil, if the definition is not associated with any file." | |||
| 693 | (car (append def nil))) | 693 | (car (append def nil))) |
| 694 | ((eq (car-safe def) 'lambda) | 694 | ((eq (car-safe def) 'lambda) |
| 695 | (nth 1 def)) | 695 | (nth 1 def)) |
| 696 | ((and (eq (car-safe def) 'autoload) | ||
| 697 | (not (eq (nth 4 def) 'keymap))) | ||
| 698 | (concat "[Arg list not available until " | ||
| 699 | "function definition is loaded.]")) | ||
| 696 | (t t)))) | 700 | (t t)))) |
| 697 | (if (listp arglist) | 701 | (cond ((listp arglist) |
| 698 | (progn | 702 | (princ (cons (if (symbolp function) function "anonymous") |
| 699 | (princ (cons (if (symbolp function) function "anonymous") | 703 | (mapcar (lambda (arg) |
| 700 | (mapcar (lambda (arg) | 704 | (if (memq arg '(&optional &rest)) |
| 701 | (if (memq arg '(&optional &rest)) | 705 | arg |
| 702 | arg | 706 | (intern (upcase (symbol-name arg))))) |
| 703 | (intern (upcase (symbol-name arg))))) | 707 | arglist))) |
| 704 | arglist))) | 708 | (terpri)) |
| 705 | (terpri)))) | 709 | ((stringp arglist) |
| 710 | (princ arglist) | ||
| 711 | (terpri)))) | ||
| 706 | (let ((doc (documentation function))) | 712 | (let ((doc (documentation function))) |
| 707 | (if doc | 713 | (if doc |
| 708 | (progn (terpri) | 714 | (progn (terpri) |
| 709 | (princ doc) | 715 | (princ doc) |
| 710 | (help-setup-xref (list #'describe-function function) interactive-p)) | 716 | (with-current-buffer standard-output |
| 717 | (beginning-of-line) | ||
| 718 | ;; Builtins get the calling sequence at the end of | ||
| 719 | ;; the doc string. Move it to the same place as | ||
| 720 | ;; for other functions. | ||
| 721 | (when (looking-at (format "(%S[ )]" function)) | ||
| 722 | (let ((start (point-marker))) | ||
| 723 | (goto-char (point-min)) | ||
| 724 | (forward-paragraph) | ||
| 725 | (insert-buffer-substring (current-buffer) start) | ||
| 726 | (insert ?\n) | ||
| 727 | (delete-region (1- start) (point-max)) | ||
| 728 | (goto-char (point-max))))) | ||
| 729 | (help-setup-xref (list #'describe-function function) | ||
| 730 | interactive-p)) | ||
| 711 | (princ "not documented"))))) | 731 | (princ "not documented"))))) |
| 712 | 732 | ||
| 713 | (defun variable-at-point () | 733 | (defun variable-at-point () |
| @@ -1290,4 +1310,73 @@ out of view." | |||
| 1290 | (new-height (max (min text-height max-height) min-height))) | 1310 | (new-height (max (min text-height max-height) min-height))) |
| 1291 | (enlarge-window (- new-height win-height))))) | 1311 | (enlarge-window (- new-height win-height))))) |
| 1292 | 1312 | ||
| 1313 | ;; `help-manyarg-func-alist' is defined primitively (in doc.c). | ||
| 1314 | ;; New primitives with `MANY' or `UNEVALLED' arglists should be added | ||
| 1315 | ;; to this alist. | ||
| 1316 | ;; The parens and function name are redundant, but it's messy to add | ||
| 1317 | ;; them in `documentation'. | ||
| 1318 | (defconst help-manyarg-func-alist | ||
| 1319 | (purecopy | ||
| 1320 | '((list . "(list &rest OBJECTS)") | ||
| 1321 | (vector . "(vector &rest OBJECTS)") | ||
| 1322 | (make-byte-code . "(make-byte-code &rest ELEMENTS)") | ||
| 1323 | (call-process | ||
| 1324 | . "(call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)") | ||
| 1325 | (string . "(string &rest CHARACTERS)") | ||
| 1326 | (+ . "(+ &rest NUMBERS-OR-MARKERS)") | ||
| 1327 | (- . "(- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS)") | ||
| 1328 | (* . "(* &rest NUMBERS-OR-MARKERS)") | ||
| 1329 | (/ . "(/ DIVIDEND DIVISOR &rest DIVISORS)") | ||
| 1330 | (max . "(max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)") | ||
| 1331 | (min . "(min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS)") | ||
| 1332 | (logand . "(logand &rest INTS-OR-MARKERS)") | ||
| 1333 | (logior . "(logior &rest INTS-OR-MARKERS)") | ||
| 1334 | (logxor . "(logxor &rest INTS-OR-MARKERS)") | ||
| 1335 | (encode-time | ||
| 1336 | . "(encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)") | ||
| 1337 | (insert . "(insert &rest ARGS)") | ||
| 1338 | (insert-before-markers . "(insert-before-markers &rest ARGS)") | ||
| 1339 | (message . "(message STRING &rest ARGUMENTS)") | ||
| 1340 | (message-box . "(message-box STRING &rest ARGUMENTS)") | ||
| 1341 | (message-or-box . "(message-or-box STRING &rest ARGUMENTS)") | ||
| 1342 | (propertize . "(propertize STRING &rest PROPERTIES)") | ||
| 1343 | (format . "(format STRING &rest OBJECTS)") | ||
| 1344 | (apply . "(apply FUNCTION &rest ARGUMENTS)") | ||
| 1345 | (run-hooks . "(run-hooks &rest HOOKS)") | ||
| 1346 | (funcall . "(funcall FUNCTION &rest ARGUMENTS)") | ||
| 1347 | (append . "(append &rest SEQUENCES)") | ||
| 1348 | (concat . "(concat &rest SEQUENCES)") | ||
| 1349 | (vconcat . "(vconcat vconcat)") | ||
| 1350 | (nconc . "(nconc &rest LISTS)") | ||
| 1351 | (widget-apply . "(widget-apply WIDGET PROPERTY &rest ARGS)") | ||
| 1352 | (make-hash-table . "(make-hash-table &rest KEYWORD-ARGS)") | ||
| 1353 | (insert-string . "(insert-string &rest ARGS)") | ||
| 1354 | (start-process . "(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)") | ||
| 1355 | (setq-default . "(setq-default SYMBOL VALUE [SYMBOL VALUE...])") | ||
| 1356 | (save-excursion . "(save-excursion &rest BODY)") | ||
| 1357 | (save-current-buffer . "(save-current-buffer &rest BODY)") | ||
| 1358 | (save-restriction . "(save-restriction &rest BODY)") | ||
| 1359 | (or . "(or CONDITIONS ...)") | ||
| 1360 | (and . "(and CONDITIONS ...)") | ||
| 1361 | (if . "(if COND THEN ELSE...)") | ||
| 1362 | (cond . "(cond CLAUSES...)") | ||
| 1363 | (progn . "(progn BODY ...)") | ||
| 1364 | (prog1 . "(prog1 FIRST BODY...)") | ||
| 1365 | (prog2 . "(prog2 X Y BODY...)") | ||
| 1366 | (setq . "(setq SYM VAL SYM VAL ...)") | ||
| 1367 | (quote . "(quote ARG)") | ||
| 1368 | (function . "(function ARG)") | ||
| 1369 | (defun . "(defun NAME ARGLIST [DOCSTRING] BODY...)") | ||
| 1370 | (defmacro . "(defmacro NAME ARGLIST [DOCSTRING] BODY...)") | ||
| 1371 | (defvar . "(defvar SYMBOL [INITVALUE DOCSTRING])") | ||
| 1372 | (defconst . "(defconst SYMBOL INITVALUE [DOCSTRING])") | ||
| 1373 | (let* . "(let* VARLIST BODY...)") | ||
| 1374 | (let . "(let VARLIST BODY...)") | ||
| 1375 | (while . "(while TEST BODY...)") | ||
| 1376 | (catch . "(catch TAG BODY...)") | ||
| 1377 | (unwind-protect . "(unwind-protect BODYFORM UNWINDFORMS...)") | ||
| 1378 | (condition-case . "(condition-case VAR BODYFORM HANDLERS...)") | ||
| 1379 | (track-mouse . "(track-mouse BOFY ...)") | ||
| 1380 | (ml-if . "(ml-if COND THEN ELSE...)")))) | ||
| 1381 | |||
| 1293 | ;;; help.el ends here | 1382 | ;;; help.el ends here |