From xemacs-m  Wed Mar 19 14:42:19 1997
Received: from mail.cis.ohio-state.edu (mail.cis.ohio-state.edu [164.107.8.55])
	by xemacs.org (8.8.5/8.8.5) with SMTP id OAA28256
	for <xemacs-beta@xemacs.org>; Wed, 19 Mar 1997 14:42:19 -0600 (CST)
Received: from calico.cis.ohio-state.edu (calico.cis.ohio-state.edu [164.107.142.11]) by mail.cis.ohio-state.edu (8.6.7/8.6.4) with ESMTP id PAA22085; Wed, 19 Mar 1997 15:42:07 -0500
Received: (ware@localhost) by calico.cis.ohio-state.edu (8.8.0/8.6.4) id PAA09718; Wed, 19 Mar 1997 15:42:07 -0500 (EST)
To: xemacs-beta@xemacs.org
Subject: Patch to *Help* that is smarter(?) about restoring window-config
From: Pete Ware <ware@cis.ohio-state.edu>
Date: 19 Mar 1997 15:42:04 -0500
Message-ID: <vwmpvwvwr4z.fsf@calico.cis.ohio-state.edu>
Lines: 68
X-Mailer: Gnus v5.4.26/XEmacs 19.15(beta99)

The following patch attempts to make "q" in the *Help* buffer be
smarter about restoring the window configuration.  In particular, if
the help buffer is already displayed in the current frame, it doesn't
update the configuration -- so when you type "q", you actually return
to the previous window configuration that did not include "*Help*".

It also makes the help window configuration a per-frame resource so
each frame can have it's own previous window configuration.
Unfortunately, each frame uses the same help buffer (hmm, I wonder if
it would be worthwhile to make the help buffer be frame specific --
i.e. each frame keeps it's own help buffer?)

--pete

/usr/contrib/bin/diff -u help.el xemacs-19.15-b101/lisp/prim/help.el
--- help.el	Wed Mar 19 15:28:01 1997
+++ xemacs-19.15-b101/lisp/prim/help.el	Tue Mar 18 15:43:56 1997
@@ -184,10 +184,11 @@
 (defun help-mode-quit ()
   "Exits from help mode, possibly restoring the previous window configuration."
   (interactive)
-  (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))
+  (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)))
         ((one-window-p)
 	 (bury-buffer))
         (t
@@ -347,6 +348,7 @@
 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
@@ -359,12 +361,7 @@
 ;;; 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))
-	(help-not-visible
-	 (not (and (windows-of-buffer "*Help*") ;shortcut
-		   (member (selected-frame)
-			   (mapcar 'window-frame
-				   (windows-of-buffer "*Help*")))))))
+        (was-one-window (one-window-p)))
     (prog1 (with-output-to-temp-buffer "*Help*"
              (prog1 (funcall thunk)
                (save-excursion
@@ -375,11 +372,7 @@
             (progn
               (save-excursion
                 (set-buffer (window-buffer helpwin))
-		;;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)))
+                (set (make-local-variable 'help-window-config) winconfig))
               (if help-selects-help-window
                   (select-window helpwin))
               (cond ((eq helpwin (selected-window))

