summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorJohn Paul Wallington <jpw@pobox.com>2007-04-06 12:15:04 +0000
committerJohn Paul Wallington <jpw@pobox.com>2007-04-06 12:15:04 +0000
commit8d6fd8d48092177de4dc93c2d929d59b41d98e9e (patch)
tree71333634292e01c526607ec72c077f1c58abe99b /lisp/subr.el
parent510def3e58b99d3fdc5d72c6633257537253ab3d (diff)
downloademacs-8d6fd8d48092177de4dc93c2d929d59b41d98e9e.tar.gz
(with-case-table): Use `make-symbol' to avoid variable capture.
Restore the table in the same buffer.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el14
1 files changed, 9 insertions, 5 deletions
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.