diff options
| author | John Paul Wallington | 2003-03-29 02:57:19 +0000 |
|---|---|---|
| committer | John Paul Wallington | 2003-03-29 02:57:19 +0000 |
| commit | ef6e365d099f5f2cd75d8ca783436e503fa5dabe (patch) | |
| tree | 87bcc76dddde5061135c5941605cc431410ca77a | |
| parent | 1a5f6e6adfcfb016b8172c92cf3e834492fdf0eb (diff) | |
| download | emacs-ef6e365d099f5f2cd75d8ca783436e503fa5dabe.tar.gz emacs-ef6e365d099f5f2cd75d8ca783436e503fa5dabe.zip | |
(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'.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/international/mule.el | 24 |
2 files changed, 23 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8a92d0d6b71..a7e5e0b7023 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-03-29 John Paul Wallington <jpw@gnu.org> | ||
| 2 | |||
| 3 | * international/mule.el (with-category-table): Use `make-symbol' | ||
| 4 | to avoid variable capture. Set table within `unwind-protect'. | ||
| 5 | Ensure table is restored in correct buffer. Add docstring. | ||
| 6 | |||
| 1 | 2003-03-29 Kenichi Handa <handa@etlken2> | 7 | 2003-03-29 Kenichi Handa <handa@etlken2> |
| 2 | 8 | ||
| 3 | * language/japan-util.el: If system-type is not for Windows, | 9 | * language/japan-util.el: If system-type is not for Windows, |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index d5e516ee059..0d96510edf8 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -593,7 +593,7 @@ character code range. Thus FUNC should iterate over [START, END]." | |||
| 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." |
| @@ -1985,12 +1985,22 @@ the table in `translation-table-vector'." | |||
| 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. |