diff lisp/prim/help.el @ 38:1a767b41a199 r19-15b102

Import from CVS: tag r19-15b102
author cvs
date Mon, 13 Aug 2007 08:54:01 +0200
parents c53a95d3c46d
children 8d2a9b52c682
line wrap: on
line diff
--- a/lisp/prim/help.el	Mon Aug 13 08:53:41 2007 +0200
+++ b/lisp/prim/help.el	Mon Aug 13 08:54:01 2007 +0200
@@ -184,11 +184,10 @@
 (defun help-mode-quit ()
   "Exits from help mode, possibly restoring the previous window configuration."
   (interactive)
-  (cond ((local-variable-p 'help-window-config (current-buffer))
-         (let ((config help-window-config))
-	   (kill-local-variable 'help-window-config)
-	   (bury-buffer)
-	   (set-window-configuration config)))
+  (cond ((frame-property (selected-frame) 'help-window-config)
+	   (set-window-configuration
+	    (frame-property (selected-frame) 'help-window-config))
+	   (set-frame-property  (selected-frame) 'help-window-config nil))
         ((one-window-p)
 	 (bury-buffer))
         (t
@@ -348,7 +347,6 @@
 This just displays the buffer in another window, rather than selecting
 the window.")
 
-(defvar help-window-config nil)
 (defvar help-window-max-height .5
   "*Proportion of frame to use for help windows.")
 ;; Use this function for displaying help when C-h something is pressed
@@ -361,7 +359,12 @@
 ;;; requirement of caller to code a lambda form in THUNK -- mrb
 (defun with-displaying-help-buffer (thunk)
   (let ((winconfig (current-window-configuration))
-        (was-one-window (one-window-p)))
+        (was-one-window (one-window-p))
+	(help-not-visible
+	 (not (and (windows-of-buffer "*Help*") ;shortcut
+		   (member (selected-frame)
+			   (mapcar 'window-frame
+				   (windows-of-buffer "*Help*")))))))
     (prog1 (with-output-to-temp-buffer "*Help*"
              (prog1 (funcall thunk)
                (save-excursion
@@ -372,7 +375,11 @@
             (progn
               (save-excursion
                 (set-buffer (window-buffer helpwin))
-                (set (make-local-variable 'help-window-config) winconfig))
+		;;If the *Help* buffer is already displayed on this
+		;; frame, don't override the previous configuration
+		(if help-not-visible
+		    (set-frame-property (selected-frame)
+					'help-window-config winconfig)))
               (if help-selects-help-window
                   (select-window helpwin))
               (cond ((eq helpwin (selected-window))