X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4607e12b53afe473f6a638f5e29f1173cb8aa902..2de477650b66e89d055051c0980bd29b07cd54e0:/lisp/help.el diff --git a/lisp/help.el b/lisp/help.el index a38d621482..b36075b811 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1,6 +1,6 @@ ;;; help.el --- help commands for Emacs -;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: help, internal @@ -661,7 +661,8 @@ It can also be nil, if the definition is not associated with any file." (save-excursion (save-match-data (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) - (help-xref-button 1 #'describe-function def))))) + (help-xref-button 1 #'describe-function def + "mouse-2, RET: describe this function"))))) (or file-name (setq file-name (symbol-file function))) (if file-name @@ -680,7 +681,8 @@ It can also be nil, if the definition is not associated with any file." (find-function-noselect arg))) (pop-to-buffer (car location)) (goto-char (cdr location)))) - function))))) + function + "mouse-2, RET: find function's definition"))))) (if need-close (princ ")")) (princ ".") (terpri) @@ -693,21 +695,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 () @@ -770,6 +792,7 @@ Returns the documentation as a string, also." (set-buffer standard-output) (if (> (count-lines (point-min) (point-max)) 10) (progn + (set-syntax-table emacs-lisp-mode-syntax-table) (goto-char (point-min)) (if valvoid (forward-line 1) @@ -800,7 +823,9 @@ Returns the documentation as a string, also." (re-search-backward (concat "\\(" customize-label "\\)") nil t) (help-xref-button 1 #'(lambda (v) - (customize-variable v)) variable) + (customize-variable v)) + variable + "mouse-2, RET: customize variable") )))) ;; Make a hyperlink to the library if appropriate. (Don't ;; change the format of the buffer's initial line in case @@ -813,12 +838,13 @@ Returns the documentation as a string, also." (with-current-buffer "*Help*" (save-excursion (re-search-backward "`\\([^`']+\\)'" nil t) - (help-xref-button 1 (lambda (arg) - (let ((location - (find-variable-noselect arg))) - (pop-to-buffer (car location)) - (goto-char (cdr location)))) - variable))))) + (help-xref-button + 1 (lambda (arg) + (let ((location + (find-variable-noselect arg))) + (pop-to-buffer (car location)) + (goto-char (cdr location)))) + variable "mouse-2, RET: find variable's definition"))))) (print-help-return-message) (save-excursion @@ -1010,7 +1036,8 @@ that." (save-match-data (unless (string-match "^([^)]+)" data) (setq data (concat "(emacs)" data)))) - (help-xref-button 1 #'info data)))) + (help-xref-button 1 #'info data + "mouse-2, RET: read this Info node")))) ;; Quoted symbols (save-excursion (while (re-search-forward help-xref-symbol-regexp nil t) @@ -1021,15 +1048,29 @@ that." ((match-string 3) ; `variable' &c (and (boundp sym) ; `variable' doesn't ensure ; it's actually bound - (help-xref-button 6 #'describe-variable sym))) + (help-xref-button + 6 #'describe-variable sym + "mouse-2, RET: describe this variable"))) ((match-string 4) ; `function' &c (and (fboundp sym) ; similarly - (help-xref-button 6 #'describe-function sym))) + (help-xref-button + 6 #'describe-function sym + "mouse-2, RET: describe this function"))) ((match-string 5)) ; nothing for symbol - ((or (boundp sym) (fboundp sym)) + ((and (boundp sym) (fboundp sym)) ;; We can't intuit whether to use the ;; variable or function doc -- supply both. - (help-xref-button 6 #'help-xref-interned sym))))))) + (help-xref-button + 6 #'help-xref-interned sym + "mouse-2, RET: describe this symbol")) + ((boundp sym) + (help-xref-button + 6 #'describe-variable sym + "mouse-2, RET: describe this variable")) + ((fboundp sym) + (help-xref-button + 6 #'describe-function sym + "mouse-2, RET: describe this function"))))))) ;; An obvious case of a key substitution: (save-excursion (while (re-search-forward @@ -1038,7 +1079,9 @@ that." "\\