From: Gerd Moellmann Date: Wed, 17 Nov 1999 21:09:57 +0000 (+0000) Subject: (with-syntax-table): Save buffer explicitly instead of X-Git-Tag: emacs-pretest-21.0.90~6074 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aad9b36243379091af9b783ea69fd7b04db0463e;p=emacs.git (with-syntax-table): Save buffer explicitly instead of using save-excursion. --- diff --git a/lisp/simple.el b/lisp/simple.el index 279a76ad713..084bf39e8cc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4139,16 +4139,19 @@ after it has been set up properly in other respects." (defmacro with-syntax-table (table &rest body) "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. -Point, mark, current buffer, and syntax table are saved, BODY is -evaluated, and the saved values are restored, even in case of an -abnormal exit. Value is what BODY returns." - (let ((old-table (gensym))) - '(let ((,old-table (syntax-table))) +Current buffer and syntax table are saved, BODY is evaluated, and the +saved values are restored, even in case of an abnormal exit. +Value is what BODY returns." + (let ((old-table (gensym)) + (old-buffer (gensym))) + '(let ((,old-table (syntax-table)) + (,old-buffer (current-buffer))) (unwind-protect - (save-excursion + (progn (set-syntax-table (copy-syntax-table ,table)) ,@body) - (set-syntax-table ,old-table))))) + (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))