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...).") :supertype 'help-xref 'help-function (lambda (fun file) (require 'find-func) + (when (eq file 'C-source) + (setq file + (help-C-file-name (indirect-function fun) 'fun))) ;; Don't use find-function-noselect because it follows ;; aliases (which fails for built-in functions). (let ((location - (cond - ((bufferp file) (cons file fun)) - ((string-match "\\`src/\\(.*\\.c\\)" file) - (help-find-C-source fun (match-string 1 file) 'fun)) - (t (find-function-search-for-symbol fun nil file))))) + (find-function-search-for-symbol fun nil file))) (pop-to-buffer (car location)) (goto-char (cdr location)))) 'help-echo (purecopy "mouse-2, RET: find function's definition")) @@ -162,11 +161,9 @@ The format is (FUNCTION ARGS...).") (define-button-type 'help-variable-def :supertype 'help-xref 'help-function (lambda (var &optional file) - (let ((location - (cond - ((string-match "\\`src/\\(.*\\.c\\)" file) - (help-find-C-source var (match-string 1 file) 'var)) - (t (find-variable-noselect var file))))) + (when (eq file 'C-source) + (setq file (help-C-file-name var 'var))) + (let ((location (find-variable-noselect var file))) (pop-to-buffer (car location)) (goto-char (cdr location)))) 'help-echo (purecopy"mouse-2, RET: find variable's definition")) @@ -195,14 +192,17 @@ Commands: ;;;###autoload (defun help-mode-finish () + (let ((entry (assq (selected-window) view-return-to-alist))) + (if entry (setcdr entry (cons (selected-window) + help-return-method)) + (setq view-return-to-alist + (cons (cons (selected-window) help-return-method) + view-return-to-alist)))) (when (eq major-mode 'help-mode) ;; View mode's read-only status of existing *Help* buffer is lost ;; by with-output-to-temp-buffer. (toggle-read-only 1) - (help-make-xrefs (current-buffer))) - (setq view-return-to-alist - (list (cons (selected-window) help-return-method)))) - + (help-make-xrefs (current-buffer)))) ;; Grokking cross-reference information in doc strings and ;; hyperlinking it. @@ -577,12 +577,11 @@ help buffer." (goto-char position))))) (defun help-go-back () - "Invoke the [back] button (if any) in the Help mode buffer." + "Go back to previous topic in this help buffer." (interactive) - (let ((back-button (button-at (1- (point-max))))) - (if back-button - (button-activate back-button) - (error "No [back] button")))) + (if help-xref-stack + (help-xref-go-back (current-buffer)) + (error "No previous help buffer."))) (defun help-do-xref (pos function args) "Call the help cross-reference function FUNCTION with args ARGS. |