Implement mechanism to save a screen configuration for a given dynamic
authorChris Hanson <org/chris-hanson/cph>
Sun, 1 Feb 1998 05:12:21 +0000 (05:12 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sun, 1 Feb 1998 05:12:21 +0000 (05:12 +0000)
extent.

v7/src/edwin/buffrm.scm
v7/src/edwin/edwin.pkg

index 3b7c8c8f335f0cf9a0d624164d7f1a8b5f036223..a6f7af6c2a491313c2517a4e936da486640b92e1 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: buffrm.scm,v 1.51 1996/05/14 01:24:05 cph Exp $
+;;;    $Id: buffrm.scm,v 1.52 1998/02/01 05:11:35 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-96 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-98 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -516,4 +516,24 @@ Automatically becomes local when set in any fashion."
                    configuration)))
              (if window
                  (weak-set-car! *minibuffer-scroll-window*
-                                (convert-window window)))))))))
\ No newline at end of file
+                                (convert-window window)))))))))
+\f
+(define (with-saved-configuration thunk)
+  (let ((screen (selected-screen)))
+    (let ((configuration (screen-window-configuration screen)))
+      (fluid-let ((restore-saved-continuation? #t))
+       (dynamic-wind
+        (lambda () unspecific)
+        thunk
+        (lambda ()
+          (if restore-saved-continuation?
+              (set-screen-window-configuration! screen configuration))))))))
+
+(define (dont-restore-saved-configuration)
+  ;; This conditional will signal an error if this procedure is called
+  ;; outside the dynamic context of WITH-SAVED-CONFIGURATION.
+  (if restore-saved-continuation?
+      (set! restore-saved-continuation? #f))
+  unspecific)
+
+(define restore-saved-continuation?)
\ No newline at end of file
index 389a0eb761f131fc15e3302df44ca68e702853a7..24e269ed9a595072d6e8f0b252c2b1f8d5f73b28 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: edwin.pkg,v 1.219 1998/01/29 06:05:35 cph Exp $
+$Id: edwin.pkg,v 1.220 1998/02/01 05:12:21 cph Exp $
 
 Copyright (c) 1989-98 Massachusetts Institute of Technology
 
@@ -297,6 +297,7 @@ MIT in each case. |#
          display-style/ignore-input?
          display-style/ignore-redisplay-flags?
          display-style/no-screen-output?
+         dont-restore-saved-configuration
          edwin-variable$cursor-centering-point
          edwin-variable$mode-line-inverse-video
          edwin-variable$scroll-step
@@ -339,7 +340,8 @@ MIT in each case. |#
          window-select-time
          window-set-override-message!
          window-start-mark
-         window-y-center)
+         window-y-center
+         with-saved-configuration)
   (export (edwin screen)
          editor-frame-screen
          editor-frame-select-cursor!