changeset 21188:607ce9d7cf53

(help-mode-maybe): Set view-return-to-alist. (help-return-method): New variable. (print-help-return-message): Set help-return-method.
author Richard M. Stallman <rms@gnu.org>
date Mon, 16 Mar 1998 04:10:19 +0000
parents f072dd90378d
children 14e52c1a5d68
files lisp/help.el
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Mon Mar 16 04:09:04 1998 +0000
+++ b/lisp/help.el	Mon Mar 16 04:10:19 1998 +0000
@@ -129,7 +129,9 @@
 
 (defun help-mode-maybe ()
   (if (eq major-mode 'fundamental-mode)
-      (help-mode)))
+      (help-mode))
+  (setq view-return-to-alist
+	(list (cons (selected-window) help-return-method))))
 
 (add-hook 'temp-buffer-show-hook 'help-mode-maybe)
 
@@ -228,6 +230,13 @@
 			 key-desc
 			 (if (symbolp defn) defn (prin1-to-string defn)))))))))
 
+(defvar help-return-method nil
+  "What to do to \"exit\" the help buffer.
+This is a list
+ (WINDOW . t)              delete the selected window, go to WINDOW.
+ (WINDOW . quit-window)    do quit-window, then select WINDOW.
+ (WINDOW BUF START POINT)  display BUF at START, POINT, then select WINDOW.")
+
 (defun print-help-return-message (&optional function)
   "Display or return message saying how to restore windows after help command.
 Computes a message and applies the optional argument FUNCTION to it.
@@ -235,6 +244,7 @@
   (and (not (get-buffer-window standard-output))
        (let ((first-message
 	      (cond ((special-display-p (buffer-name standard-output))
+		     (setq help-return-method (cons (selected-window) t))
 		     ;; If the help output buffer is a special display buffer,
 		     ;; don't say anything about how to get rid of it.
 		     ;; First of all, the user will do that with the window
@@ -243,10 +253,16 @@
 		     ;; so we don't know whether its frame will be selected.
 		     nil)
 		    ((not (one-window-p t))
+		     (setq help-return-method
+			   (cons (selected-window) 'quit-window))
 		     "Type \\[switch-to-buffer-other-window] RET to restore the other window.")
 		    (pop-up-windows
+		     (setq help-return-method (cons (selected-window) t))
 		     "Type \\[delete-other-windows] to remove help window.")
 		    (t
+		     (setq help-return-method
+			   (list (selected-window) (window-buffer)
+				 (window-start) (window-point)))
 		     "Type \\[switch-to-buffer] RET to remove help window."))))
 	 (funcall (or function 'message)
 		  (concat