Fix bug: UNDO-LOCAL-BINDINGS! must run the variable assignment daemons
authorChris Hanson <org/chris-hanson/cph>
Fri, 5 Nov 1999 05:37:41 +0000 (05:37 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 5 Nov 1999 05:37:41 +0000 (05:37 +0000)
for the impermanent variables, and not the permanent variables.  What
it was doing was running it on a subset of the permanent variables,
due to a stupid programming error.

v7/src/edwin/buffer.scm

index 70bcb4991c44be0c46bbe6d1cfa3e9129e9a7221..a01ef9d279b92573408d9cf27c6f20cf01170709 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: buffer.scm,v 1.172 1999/11/01 03:40:08 cph Exp $
+;;; $Id: buffer.scm,v 1.173 1999/11/05 05:37:41 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology
 ;;;
@@ -231,12 +231,6 @@ The buffer is guaranteed to be deselected at that time."
 (define (buffer-remove! buffer key)
   (set-buffer-alist! buffer (del-assq! key (buffer-alist buffer))))
 
-(define (remove-impermanent-bindings! alist)
-  ((list-deletor!
-    (lambda (entry)
-      (not (variable-permanent-local? (car entry)))))
-   alist))
-
 (define (->buffer object)
   (cond ((buffer? object) object)
        ((and (mark? object) (mark-buffer object)))
@@ -390,12 +384,16 @@ The buffer is guaranteed to be deselected at that time."
            ((null? bindings))
          (set-variable-%value! (caar bindings)
                                (variable-default-value (caar bindings)))))
-    (set-buffer-local-bindings!
-     buffer
-     (if all? '() (remove-impermanent-bindings! bindings)))
-    (do ((bindings bindings (cdr bindings)))
-       ((null? bindings))
-      (invoke-variable-assignment-daemons! buffer (caar bindings)))))
+    (call-with-values
+       (lambda ()
+         (split-list bindings
+                     (lambda (binding)
+                       (variable-permanent-local? (car binding)))))
+      (lambda (permanent impermanent)
+       (set-buffer-local-bindings! buffer (if all? '() permanent))
+       (do ((bindings impermanent (cdr bindings)))
+           ((null? bindings))
+         (invoke-variable-assignment-daemons! buffer (caar bindings)))))))
 
 (define (with-current-local-bindings! thunk)
   (dynamic-wind (lambda ()