# HG changeset patch # User John Paul Wallington # Date 1175861704 0 # Node ID 85841d69399734c5741cebb2957df32ac8fe706a # Parent 9863cec1b6ca2bc6e2e346166da97ac7e70ef9ee (with-case-table): Use `make-symbol' to avoid variable capture. Restore the table in the same buffer. diff -r 9863cec1b6ca -r 85841d693997 lisp/subr.el --- a/lisp/subr.el Fri Apr 06 00:07:14 2007 +0000 +++ b/lisp/subr.el Fri Apr 06 12:15:04 2007 +0000 @@ -2485,11 +2485,15 @@ "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.