From 8d6fd8d48092177de4dc93c2d929d59b41d98e9e Mon Sep 17 00:00:00 2001 From: John Paul Wallington Date: Fri, 6 Apr 2007 12:15:04 +0000 Subject: [PATCH] (with-case-table): Use `make-symbol' to avoid variable capture. Restore the table in the same buffer. --- lisp/subr.el | 14 +++++++++----- 1 file 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. -- 2.39.2