changeset 26521:5efbe3ff1f09

(with-syntax-table): Don't switch buffers.
author Gerd Moellmann <gerd@gnu.org>
date Sun, 21 Nov 1999 15:07:25 +0000
parents bd832bb8fbc0
children bfce4a7deb1c
files lisp/simple.el
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Nov 21 14:50:21 1999 +0000
+++ b/lisp/simple.el	Sun Nov 21 15:07:25 1999 +0000
@@ -4142,8 +4142,8 @@
 
 (defmacro with-syntax-table (table &rest body)
   "Evaluate BODY with syntax table of current buffer set to a copy of TABLE.
-Current buffer and syntax table are saved, BODY is evaluated, and the
-saved values are restored, even in case of an abnormal exit.
+The syntax table of the current buffer is saved, BODY is evaluated, and the
+saved table is restored, even in case of an abnormal exit.
 Value is what BODY returns."
   (let ((old-table (gensym))
 	(old-buffer (gensym)))
@@ -4153,8 +4153,9 @@
 	   (progn
 	     (set-syntax-table (copy-syntax-table ,table))
 	     ,@body)
-	 (set-buffer ,old-buffer)
-	 (set-syntax-table ,old-table)))))
+	 (save-current-buffer
+	   (set-buffer ,old-buffer)
+	   (set-syntax-table ,old-table))))))
 
 (put 'with-syntax-table 'lisp-indent-function 1)
 (put 'with-syntax-table 'edebug-form-spec '(form body))