diff lisp/subr.el @ 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 8693ff852e51
children 85841d693997
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.