comparison lisp/subr.el @ 76960:85841d693997

(with-case-table): Use `make-symbol' to avoid variable capture. Restore the table in the same buffer.
author John Paul Wallington <jpw@pobox.com>
date Fri, 06 Apr 2007 12:15:04 +0000
parents 1b8e8619079e
children 055a54275ec3
comparison
equal deleted inserted replaced
76959:9863cec1b6ca 76960:85841d693997
2483 2483
2484 (defmacro with-case-table (table &rest body) 2484 (defmacro with-case-table (table &rest body)
2485 "Execute the forms in BODY with TABLE as the current case table. 2485 "Execute the forms in BODY with TABLE as the current case table.
2486 The value returned is the value of the last form in BODY." 2486 The value returned is the value of the last form in BODY."
2487 (declare (indent 1) (debug t)) 2487 (declare (indent 1) (debug t))
2488 `(let ((old-case-table (current-case-table))) 2488 (let ((old-case-table (make-symbol "table"))
2489 (unwind-protect 2489 (old-buffer (make-symbol "buffer")))
2490 (progn (set-case-table ,table) 2490 `(let ((,old-case-table (current-case-table))
2491 ,@body) 2491 (,old-buffer (current-buffer)))
2492 (set-case-table old-case-table)))) 2492 (unwind-protect
2493 (progn (set-case-table ,table)
2494 ,@body)
2495 (with-current-buffer ,old-buffer
2496 (set-case-table ,old-case-table))))))
2493 2497
2494 ;;;; Constructing completion tables. 2498 ;;;; Constructing completion tables.
2495 2499
2496 (defmacro dynamic-completion-table (fun) 2500 (defmacro dynamic-completion-table (fun)
2497 "Use function FUN as a dynamic completion table. 2501 "Use function FUN as a dynamic completion table.