From: John Paul Wallington <jpw@pobox.com>
Date: Fri, 6 Apr 2007 12:15:04 +0000 (+0000)
Subject: (with-case-table): Use `make-symbol' to avoid variable capture.
X-Git-Tag: emacs-pretest-22.0.98~293
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8d6fd8d48092177de4dc93c2d929d59b41d98e9e;p=emacs.git

(with-case-table): Use `make-symbol' to avoid variable capture.
Restore the table in the same buffer.
---

diff --git a/lisp/subr.el b/lisp/subr.el
index 1a49ae6c73e..1a70c53a879 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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))))))
 
 ;;;; Constructing completion tables.