]> git.eshelyaron.com Git - emacs.git/commitdiff
(with-case-table): Use `make-symbol' to avoid variable capture.
authorJohn Paul Wallington <jpw@pobox.com>
Fri, 6 Apr 2007 12:15:04 +0000 (12:15 +0000)
committerJohn Paul Wallington <jpw@pobox.com>
Fri, 6 Apr 2007 12:15:04 +0000 (12:15 +0000)
Restore the table in the same buffer.

lisp/subr.el

index 1a49ae6c73e8621f38b650aed3285b84227d88f3..1a70c53a8794e8d85568f2789e1325405e169e07 100644 (file)
@@ -2485,11 +2485,15 @@ in BODY."
   "Execute the forms in BODY with TABLE as the current case table.
 The value returned is the value of the last form in BODY."
   (declare (indent 1) (debug t))
-  `(let ((old-case-table (current-case-table)))
-     (unwind-protect
-        (progn (set-case-table ,table)
-               ,@body)
-       (set-case-table old-case-table))))
+  (let ((old-case-table (make-symbol "table"))
+       (old-buffer (make-symbol "buffer")))
+    `(let ((,old-case-table (current-case-table))
+          (,old-buffer (current-buffer)))
+       (unwind-protect
+          (progn (set-case-table ,table)
+                 ,@body)
+        (with-current-buffer ,old-buffer
+          (set-case-table ,old-case-table))))))
 \f
 ;;;; Constructing completion tables.