Mercurial > emacs
comparison lisp/international/mule.el @ 50336:15141bb6dc1f
(with-category-table): Use `make-symbol' to avoid variable capture.
Set table within `unwind-protect'. Ensure table is restored in
correct buffer. Add docstring. Basically, copy `with-syntax-table'.
author | John Paul Wallington <jpw@pobox.com> |
---|---|
date | Sat, 29 Mar 2003 02:56:35 +0000 |
parents | b88623fccdf1 |
children | 6f2a35c77d07 |
comparison
equal
deleted
inserted
replaced
50335:0d468249dd37 | 50336:15141bb6dc1f |
---|---|
591 (funcall func | 591 (funcall func |
592 (make-char charset (+ i start) start) | 592 (make-char charset (+ i start) start) |
593 (make-char charset (+ i start) (+ start chars -1))))))) | 593 (make-char charset (+ i start) (+ start chars -1))))))) |
594 | 594 |
595 (defun register-char-codings (coding-system safe-chars) | 595 (defun register-char-codings (coding-system safe-chars) |
596 "This is an obsolete function. | 596 "This is an obsolete function. |
597 It exists just for backward compatibility, and it does nothing.") | 597 It exists just for backward compatibility, and it does nothing.") |
598 (make-obsolete 'register-char-codings | 598 (make-obsolete 'register-char-codings |
599 "Unnecessary function. Calling it has no effect." | 599 "Unnecessary function. Calling it has no effect." |
600 "21.3") | 600 "21.3") |
601 | 601 |
1983 (put symbol 'translation-table-id id) | 1983 (put symbol 'translation-table-id id) |
1984 id)) | 1984 id)) |
1985 | 1985 |
1986 (put 'with-category-table 'lisp-indent-function 1) | 1986 (put 'with-category-table 'lisp-indent-function 1) |
1987 | 1987 |
1988 (defmacro with-category-table (category-table &rest body) | 1988 (defmacro with-category-table (table &rest body) |
1989 `(let ((current-category-table (category-table))) | 1989 "Evaluate BODY with category table of current buffer set to TABLE. |
1990 (set-category-table ,category-table) | 1990 The category table of the current buffer is saved, BODY is evaluated, |
1991 (unwind-protect | 1991 then the saved table is restored, even in case of an abnormal exit. |
1992 (progn ,@body) | 1992 Value is what BODY returns." |
1993 (set-category-table current-category-table)))) | 1993 (let ((old-table (make-symbol "old-table")) |
1994 (old-buffer (make-symbol "old-buffer"))) | |
1995 `(let ((,old-table (category-table)) | |
1996 (,old-buffer (current-buffer))) | |
1997 (unwind-protect | |
1998 (progn | |
1999 (set-category-table ,table) | |
2000 ,@body) | |
2001 (save-current-buffer | |
2002 (set-buffer ,old-buffer) | |
2003 (set-category-table ,old-table)))))) | |
1994 | 2004 |
1995 (defun define-translation-hash-table (symbol table) | 2005 (defun define-translation-hash-table (symbol table) |
1996 "Define SYMBOL as the name of the hash translation TABLE for use in CCL. | 2006 "Define SYMBOL as the name of the hash translation TABLE for use in CCL. |
1997 | 2007 |
1998 Analogous to `define-translation-table', but updates | 2008 Analogous to `define-translation-table', but updates |