diff lisp/subr.el @ 4369:ef9eb714f0e4

Add ascii-case-table, #'with-case-table; make iso8859-1.el more comprehensible. 2007-12-30 Aidan Kehoe <kehoea@parhasard.net> * subr.el (with-case-table): New. Idea and implementation taken from GNU's code of April 2007, before GPL V3 was implied. Thank you GNU. * iso8859-1.el (ascii-case-table): New. Idea taken from GNU. * iso8859-1.el : Change Jamie's implicit compile-time call to a macro literal into something comprehensible to and maintainable by mortals, using to cl.el's #'loop. * iso8859-1.el (ctl-arrow): Initialise it to something more comprehensible.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 30 Dec 2007 16:18:33 +0100
parents d9eb5ea14f65
children 42fad34efb3f
line wrap: on
line diff
--- a/lisp/subr.el	Mon Dec 24 14:00:51 2007 +0100
+++ b/lisp/subr.el	Sun Dec 30 16:18:33 2007 +0100
@@ -579,6 +579,19 @@
 ; 	 . ,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 (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))))))
 
 (defvar delay-mode-hooks nil
   "If non-nil, `run-mode-hooks' should delay running the hooks.")