diff options
Diffstat (limited to 'lisp/help-mode.el')
| -rw-r--r-- | lisp/help-mode.el | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 149eebb3d36..11656ec368c 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el | |||
| @@ -147,14 +147,13 @@ The format is (FUNCTION ARGS...).") | |||
| 147 | :supertype 'help-xref | 147 | :supertype 'help-xref |
| 148 | 'help-function (lambda (fun file) | 148 | 'help-function (lambda (fun file) |
| 149 | (require 'find-func) | 149 | (require 'find-func) |
| 150 | (when (eq file 'C-source) | ||
| 151 | (setq file | ||
| 152 | (help-C-file-name (indirect-function fun) 'fun))) | ||
| 150 | ;; Don't use find-function-noselect because it follows | 153 | ;; Don't use find-function-noselect because it follows |
| 151 | ;; aliases (which fails for built-in functions). | 154 | ;; aliases (which fails for built-in functions). |
| 152 | (let ((location | 155 | (let ((location |
| 153 | (cond | 156 | (find-function-search-for-symbol fun nil file))) |
| 154 | ((bufferp file) (cons file fun)) | ||
| 155 | ((string-match "\\`src/\\(.*\\.c\\)" file) | ||
| 156 | (help-find-C-source fun (match-string 1 file) 'fun)) | ||
| 157 | (t (find-function-search-for-symbol fun nil file))))) | ||
| 158 | (pop-to-buffer (car location)) | 157 | (pop-to-buffer (car location)) |
| 159 | (goto-char (cdr location)))) | 158 | (goto-char (cdr location)))) |
| 160 | 'help-echo (purecopy "mouse-2, RET: find function's definition")) | 159 | 'help-echo (purecopy "mouse-2, RET: find function's definition")) |
| @@ -162,11 +161,9 @@ The format is (FUNCTION ARGS...).") | |||
| 162 | (define-button-type 'help-variable-def | 161 | (define-button-type 'help-variable-def |
| 163 | :supertype 'help-xref | 162 | :supertype 'help-xref |
| 164 | 'help-function (lambda (var &optional file) | 163 | 'help-function (lambda (var &optional file) |
| 165 | (let ((location | 164 | (when (eq file 'C-source) |
| 166 | (cond | 165 | (setq file (help-C-file-name var 'var))) |
| 167 | ((string-match "\\`src/\\(.*\\.c\\)" file) | 166 | (let ((location (find-variable-noselect var file))) |
| 168 | (help-find-C-source var (match-string 1 file) 'var)) | ||
| 169 | (t (find-variable-noselect var file))))) | ||
| 170 | (pop-to-buffer (car location)) | 167 | (pop-to-buffer (car location)) |
| 171 | (goto-char (cdr location)))) | 168 | (goto-char (cdr location)))) |
| 172 | 'help-echo (purecopy"mouse-2, RET: find variable's definition")) | 169 | 'help-echo (purecopy"mouse-2, RET: find variable's definition")) |
| @@ -195,14 +192,17 @@ Commands: | |||
| 195 | 192 | ||
| 196 | ;;;###autoload | 193 | ;;;###autoload |
| 197 | (defun help-mode-finish () | 194 | (defun help-mode-finish () |
| 195 | (let ((entry (assq (selected-window) view-return-to-alist))) | ||
| 196 | (if entry (setcdr entry (cons (selected-window) | ||
| 197 | help-return-method)) | ||
| 198 | (setq view-return-to-alist | ||
| 199 | (cons (cons (selected-window) help-return-method) | ||
| 200 | view-return-to-alist)))) | ||
| 198 | (when (eq major-mode 'help-mode) | 201 | (when (eq major-mode 'help-mode) |
| 199 | ;; View mode's read-only status of existing *Help* buffer is lost | 202 | ;; View mode's read-only status of existing *Help* buffer is lost |
| 200 | ;; by with-output-to-temp-buffer. | 203 | ;; by with-output-to-temp-buffer. |
| 201 | (toggle-read-only 1) | 204 | (toggle-read-only 1) |
| 202 | (help-make-xrefs (current-buffer))) | 205 | (help-make-xrefs (current-buffer)))) |
| 203 | (setq view-return-to-alist | ||
| 204 | (list (cons (selected-window) help-return-method)))) | ||
| 205 | |||
| 206 | 206 | ||
| 207 | ;; Grokking cross-reference information in doc strings and | 207 | ;; Grokking cross-reference information in doc strings and |
| 208 | ;; hyperlinking it. | 208 | ;; hyperlinking it. |
| @@ -577,12 +577,11 @@ help buffer." | |||
| 577 | (goto-char position))))) | 577 | (goto-char position))))) |
| 578 | 578 | ||
| 579 | (defun help-go-back () | 579 | (defun help-go-back () |
| 580 | "Invoke the [back] button (if any) in the Help mode buffer." | 580 | "Go back to previous topic in this help buffer." |
| 581 | (interactive) | 581 | (interactive) |
| 582 | (let ((back-button (button-at (1- (point-max))))) | 582 | (if help-xref-stack |
| 583 | (if back-button | 583 | (help-xref-go-back (current-buffer)) |
| 584 | (button-activate back-button) | 584 | (error "No previous help buffer."))) |
| 585 | (error "No [back] button")))) | ||
| 586 | 585 | ||
| 587 | (defun help-do-xref (pos function args) | 586 | (defun help-do-xref (pos function args) |
| 588 | "Call the help cross-reference function FUNCTION with args ARGS. | 587 | "Call the help cross-reference function FUNCTION with args ARGS. |