Mercurial > hg > xemacs-beta
changeset 4319:74d00c7cc134
Specify coding-system-for-write, add a coding cookie in #'write-abbrev-file.
2007-12-09 Aidan Kehoe <kehoea@parhasard.net>
* abbrev.el (write-abbrev-file):
Write FILE using escape-quoted, as a coding system. Add a coding
cookie to specify exactly what coding system was used
(escape-quoted is aliased to binary on non-Mule). Thank you for
the bug report, Uwe Brauer.
This bug would have been resolved ages ago if we had merged
Dave Love's 2002 changes from GNU. Nope, I didn't merge the whole
file when doing this.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Dec 2007 18:31:41 +0100 |
parents | 4d0f773d5e21 |
children | a78603f584d7 63c25d1cbecf |
files | lisp/ChangeLog lisp/abbrev.el |
diffstat | 2 files changed, 29 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Dec 09 15:10:46 2007 +0100 +++ b/lisp/ChangeLog Sun Dec 09 18:31:41 2007 +0100 @@ -1,3 +1,15 @@ +2007-12-09 Aidan Kehoe <kehoea@parhasard.net> + + * abbrev.el (write-abbrev-file): + Write FILE using escape-quoted, as a coding system. Add a coding + cookie to specify exactly what coding system was used + (escape-quoted is aliased to binary on non-Mule). Thank you for + the bug report, Uwe Brauer. + + This bug would have been resolved ages ago if we had merged + Dave Love's 2002 changes from GNU. Nope, I didn't merge the whole + file when doing this. + 2007-12-09 Aidan Kehoe <kehoea@parhasard.net> * unicode.el (load-unicode-mapping-tables):
--- a/lisp/abbrev.el Sun Dec 09 15:10:46 2007 +0100 +++ b/lisp/abbrev.el Sun Dec 09 18:31:41 2007 +0100 @@ -421,8 +421,11 @@ (defun write-abbrev-file (file) "Write all abbrev definitions to a file of Lisp code. +This does not include system abbrevs; it includes only the abbrev tables +listed in listed in `abbrev-table-name-list'. The file written can be loaded in another session to define the same abbrevs. -The argument FILE is the file name to write." +The argument FILE is the file name to write. If omitted or nil, the file +specified in `abbrev-file-name' is used." (interactive (list (read-file-name "Write abbrev file: " @@ -430,15 +433,19 @@ abbrev-file-name))) (or (and file (> (length file) 0)) (setq file abbrev-file-name)) - (save-excursion - (set-buffer (get-buffer-create " write-abbrev-file")) - (erase-buffer) - (let ((tables abbrev-table-name-list)) - (while tables - (insert-abbrev-table-description (car tables) nil) - (setq tables (cdr tables)))) - (write-region 1 (point-max) file) - (erase-buffer))) + (let ((coding-system-for-write 'escape-quoted)) + (with-temp-file file + ;; XEmacs change; not emacs-mule, and use the coding system + ;; escape-quoted resolves to, which will differ depending on whether + ;; the build is Mule or not. + (insert (format ";;-*-coding: %s;-*-\n" + (coding-system-name + (find-coding-system coding-system-for-write)))) + (dolist (table + ;; XEmacs change; we keep the table sorted at runtime, no + ;; need to sort it here. + abbrev-table-name-list) + (insert-abbrev-table-description table nil))))) (defun abbrev-string-to-be-defined (arg) "Return the string for which an abbrev will be defined.