comparison lisp/simple.el @ 26466:b32572666174

(with-syntax-table): New.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 16 Nov 1999 13:29:51 +0000
parents 285ab8ddc125
children 46323650988d
comparison
equal deleted inserted replaced
26465:b9ad44d699ec 26466:b32572666174
24 24
25 ;; A grab-bag of basic Emacs commands not specifically related to some 25 ;; A grab-bag of basic Emacs commands not specifically related to some
26 ;; major mode or to file-handling. 26 ;; major mode or to file-handling.
27 27
28 ;;; Code: 28 ;;; Code:
29
30 (eval-when-compile
31 (require 'cl))
32
29 33
30 (defgroup killing nil 34 (defgroup killing nil
31 "Killing and yanking commands" 35 "Killing and yanking commands"
32 :group 'editing) 36 :group 'editing)
33 37
4130 ;; for cloning to work properly). 4134 ;; for cloning to work properly).
4131 (run-hooks 'clone-buffer-hook)) 4135 (run-hooks 'clone-buffer-hook))
4132 (if display-flag (pop-to-buffer new)) 4136 (if display-flag (pop-to-buffer new))
4133 new)) 4137 new))
4134 4138
4139
4140 (defmacro with-syntax-table (table &rest body)
4141 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE.
4142 Point, mark, current buffer, and syntax table are saved, BODY is
4143 evaluated, and the saved values are restored, even in case of an
4144 abnormal exit. Value is what BODY returns."
4145 (let ((old-table (gensym)))
4146 '(let ((,old-table (syntax-table)))
4147 (unwind-protect
4148 (save-excursion
4149 (set-syntax-table (copy-syntax-table ,table))
4150 ,@body)
4151 (set-syntax-table ,old-table)))))
4152
4153 (put 'with-syntax-table 'lisp-indent-function 1)
4154 (put 'with-syntax-table 'edebug-form-spec '(form body))
4155
4135 ;;; simple.el ends here 4156 ;;; simple.el ends here