diff options
| author | Stefan Monnier | 2001-10-11 23:34:07 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-11 23:34:07 +0000 |
| commit | 8422a3b87df3de700b7884abc74d5bf12ccca772 (patch) | |
| tree | 379b37607dab18d32e0c72e8340d2f43c8aa6729 | |
| parent | 89f5b33fc70bdc2f0edc4a0ef75542a1a12bc133 (diff) | |
| download | emacs-8422a3b87df3de700b7884abc74d5bf12ccca772.tar.gz emacs-8422a3b87df3de700b7884abc74d5bf12ccca772.zip | |
(describe-function-1): Remove unused `parens' arg.
Don't call help-setup-xref anymore and remove its `interactive-p' arg.
Autoload and cleanup.
(describe-function): Call help-setup-xref.
(describe-variable): Call help-setup-xref earlier.
| -rw-r--r-- | lisp/help-funs.el | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lisp/help-funs.el b/lisp/help-funs.el index 6f84bc512bf..73cde500543 100644 --- a/lisp/help-funs.el +++ b/lisp/help-funs.el | |||
| @@ -33,6 +33,9 @@ | |||
| 33 | 33 | ||
| 34 | ;;; Code: | 34 | ;;; Code: |
| 35 | 35 | ||
| 36 | (require 'help-mode) | ||
| 37 | |||
| 38 | |||
| 36 | ;;;###autoload | 39 | ;;;###autoload |
| 37 | (defun help-with-tutorial (&optional arg) | 40 | (defun help-with-tutorial (&optional arg) |
| 38 | "Select the Emacs learn-by-doing tutorial. | 41 | "Select the Emacs learn-by-doing tutorial. |
| @@ -144,23 +147,24 @@ and the file name is displayed in the echo area." | |||
| 144 | fn (intern val))))) | 147 | fn (intern val))))) |
| 145 | (if (null function) | 148 | (if (null function) |
| 146 | (message "You didn't specify a function") | 149 | (message "You didn't specify a function") |
| 147 | (with-output-to-temp-buffer "*Help*" | 150 | (help-setup-xref (list #'describe-function function) (interactive-p)) |
| 151 | (with-output-to-temp-buffer (help-buffer) | ||
| 148 | (prin1 function) | 152 | (prin1 function) |
| 149 | ;; Use " is " instead of a colon so that | 153 | ;; Use " is " instead of a colon so that |
| 150 | ;; it is easier to get out the function name using forward-sexp. | 154 | ;; it is easier to get out the function name using forward-sexp. |
| 151 | (princ " is ") | 155 | (princ " is ") |
| 152 | (describe-function-1 function nil (interactive-p)) | 156 | (describe-function-1 function) |
| 153 | (print-help-return-message) | 157 | (print-help-return-message) |
| 154 | (save-excursion | 158 | (with-current-buffer standard-output |
| 155 | (set-buffer standard-output) | 159 | ;; Return the text we displayed. |
| 156 | ;; Return the text we displayed. | ||
| 157 | (buffer-string))))) | 160 | (buffer-string))))) |
| 158 | 161 | ||
| 159 | (defun describe-function-1 (function parens interactive-p) | 162 | ;;;###autoload |
| 163 | (defun describe-function-1 (function) | ||
| 160 | (let* ((def (if (symbolp function) | 164 | (let* ((def (if (symbolp function) |
| 161 | (symbol-function function) | 165 | (symbol-function function) |
| 162 | function)) | 166 | function)) |
| 163 | file-name string need-close | 167 | file-name string |
| 164 | (beg (if (commandp def) "an interactive " "a "))) | 168 | (beg (if (commandp def) "an interactive " "a "))) |
| 165 | (setq string | 169 | (setq string |
| 166 | (cond ((or (stringp def) | 170 | (cond ((or (stringp def) |
| @@ -202,30 +206,26 @@ and the file name is displayed in the echo area." | |||
| 202 | "a full keymap" | 206 | "a full keymap" |
| 203 | "a sparse keymap"))) | 207 | "a sparse keymap"))) |
| 204 | (t ""))) | 208 | (t ""))) |
| 205 | (when (and parens (not (equal string ""))) | ||
| 206 | (setq need-close t) | ||
| 207 | (princ "(")) | ||
| 208 | (princ string) | 209 | (princ string) |
| 209 | (with-current-buffer "*Help*" | 210 | (with-current-buffer standard-output |
| 210 | (save-excursion | 211 | (save-excursion |
| 211 | (save-match-data | 212 | (save-match-data |
| 212 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) | 213 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) |
| 213 | (help-xref-button 1 'help-function def))))) | 214 | (help-xref-button 1 'help-function def))))) |
| 214 | (or file-name | 215 | (or file-name |
| 215 | (setq file-name (symbol-file function))) | 216 | (setq file-name (symbol-file function))) |
| 216 | (if file-name | 217 | (cond |
| 217 | (progn | 218 | (file-name |
| 218 | (princ " in `") | 219 | (princ " in `") |
| 219 | ;; We used to add .el to the file name, | 220 | ;; We used to add .el to the file name, |
| 220 | ;; but that's completely wrong when the user used load-file. | 221 | ;; but that's completely wrong when the user used load-file. |
| 221 | (princ file-name) | 222 | (princ file-name) |
| 222 | (princ "'") | 223 | (princ "'") |
| 223 | ;; Make a hyperlink to the library. | 224 | ;; Make a hyperlink to the library. |
| 224 | (with-current-buffer "*Help*" | 225 | (with-current-buffer standard-output |
| 225 | (save-excursion | 226 | (save-excursion |
| 226 | (re-search-backward "`\\([^`']+\\)'" nil t) | 227 | (re-search-backward "`\\([^`']+\\)'" nil t) |
| 227 | (help-xref-button 1 'help-function-def function file-name))))) | 228 | (help-xref-button 1 'help-function-def function file-name))))) |
| 228 | (if need-close (princ ")")) | ||
| 229 | (princ ".") | 229 | (princ ".") |
| 230 | (terpri) | 230 | (terpri) |
| 231 | (when (commandp function) | 231 | (when (commandp function) |
| @@ -294,9 +294,7 @@ and the file name is displayed in the echo area." | |||
| 294 | (forward-paragraph) | 294 | (forward-paragraph) |
| 295 | (insert | 295 | (insert |
| 296 | "[Missing arglist. Please make a bug report.]\n"))) | 296 | "[Missing arglist. Please make a bug report.]\n"))) |
| 297 | (goto-char (point-max)))) | 297 | (goto-char (point-max))))) |
| 298 | (help-setup-xref (list #'describe-function function) | ||
| 299 | interactive-p)) | ||
| 300 | (princ "not documented"))))) | 298 | (princ "not documented"))))) |
| 301 | 299 | ||
| 302 | 300 | ||
| @@ -341,8 +339,10 @@ it is displayed along with the global value." | |||
| 341 | (if (not (symbolp variable)) | 339 | (if (not (symbolp variable)) |
| 342 | (message "You did not specify a variable") | 340 | (message "You did not specify a variable") |
| 343 | (let (valvoid) | 341 | (let (valvoid) |
| 342 | (help-setup-xref (list #'describe-variable variable buffer) | ||
| 343 | (interactive-p)) | ||
| 344 | (with-output-to-temp-buffer (help-buffer) | ||
| 344 | (with-current-buffer buffer | 345 | (with-current-buffer buffer |
| 345 | (with-output-to-temp-buffer "*Help*" | ||
| 346 | (prin1 variable) | 346 | (prin1 variable) |
| 347 | (if (not (boundp variable)) | 347 | (if (not (boundp variable)) |
| 348 | (progn | 348 | (progn |
| @@ -407,8 +407,6 @@ it is displayed along with the global value." | |||
| 407 | (terpri) | 407 | (terpri) |
| 408 | (let ((doc (documentation-property variable 'variable-documentation))) | 408 | (let ((doc (documentation-property variable 'variable-documentation))) |
| 409 | (princ (or doc "not documented as a variable."))) | 409 | (princ (or doc "not documented as a variable."))) |
| 410 | (help-setup-xref (list #'describe-variable variable (current-buffer)) | ||
| 411 | (interactive-p)) | ||
| 412 | 410 | ||
| 413 | ;; Make a link to customize if this variable can be customized. | 411 | ;; Make a link to customize if this variable can be customized. |
| 414 | ;; Note, it is not reliable to test only for a custom-type property | 412 | ;; Note, it is not reliable to test only for a custom-type property |