# HG changeset patch # User Aidan Kehoe # Date 1197221501 -3600 # Node ID 74d00c7cc134a6cc94eac170ca774ecef7736ee8 # Parent 4d0f773d5e211688cf56f51aaeea2054f3eb016d Specify coding-system-for-write, add a coding cookie in #'write-abbrev-file. 2007-12-09 Aidan Kehoe * 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. diff -r 4d0f773d5e21 -r 74d00c7cc134 lisp/ChangeLog --- 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 + + * 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 * unicode.el (load-unicode-mapping-tables): diff -r 4d0f773d5e21 -r 74d00c7cc134 lisp/abbrev.el --- 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.