changeset 76939:1b8e8619079e

* subr.el (with-case-table): New macro.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 04 Apr 2007 15:34:43 +0000
parents c43eb2a211a9
children c4ac2750f7e4
files lisp/subr.el
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed Apr 04 15:34:34 2007 +0000
+++ b/lisp/subr.el	Wed Apr 04 15:34:43 2007 +0000
@@ -2480,6 +2480,16 @@
        (let ((combine-after-change-calls t))
 	 . ,body)
      (combine-after-change-execute)))
+
+(defmacro with-case-table (table &rest 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))))
 
 ;;;; Constructing completion tables.