Mercurial > emacs
changeset 86986:a66a6a9bd1aa
* lisp/saveplace.el (save-place-alist-to-file): Set coding-system-for-write
once and refer to it throughout. Based on a patch by David Reitter
<dreitter{_AT_}inf.ed.ac.uk>.
author | Karl Fogel <kfogel@red-bean.com> |
---|---|
date | Sun, 02 Dec 2007 21:24:38 +0000 |
parents | 783469dd1f73 |
children | 7bd1703d4880 |
files | lisp/ChangeLog lisp/saveplace.el |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Dec 02 21:15:22 2007 +0000 +++ b/lisp/ChangeLog Sun Dec 02 21:24:38 2007 +0000 @@ -1,3 +1,9 @@ +2007-12-02 Karl Fogel <kfogel@red-bean.com> + + * saveplace.el (save-place-alist-to-file): Set + coding-system-for-write once and refer to it throughout. + Based on a patch by David Reitter <dreitter{_AT_}inf.ed.ac.uk>. + 2007-12-02 Karl Fogel <kfogel@red-bean.com> * saveplace.el (save-place-alist-to-file): Use `utf-8' coding
--- a/lisp/saveplace.el Sun Dec 02 21:15:22 2007 +0000 +++ b/lisp/saveplace.el Sun Dec 02 21:24:38 2007 +0000 @@ -209,7 +209,8 @@ (setq save-place-alist (cdr save-place-alist))))) (defun save-place-alist-to-file () - (let ((file (expand-file-name save-place-file))) + (let ((file (expand-file-name save-place-file)) + (coding-system-for-write 'utf-8)) (save-excursion (unless save-place-quiet (message "Saving places to %s..." file)) @@ -217,7 +218,8 @@ (delete-region (point-min) (point-max)) (when save-place-forget-unreadable-files (save-place-forget-unreadable-files)) - (insert ";;; -*- coding: utf-8 -*-\n") + (insert (format ";;; -*- coding: %s -*-\n" + (symbol-name coding-system-for-write))) (let ((print-length nil) (print-level nil)) (print save-place-alist (current-buffer))) @@ -230,8 +232,7 @@ t)))) (condition-case nil ;; Don't use write-file; we don't want this buffer to visit it. - (let ((coding-system-for-write 'utf-8)) - (write-region (point-min) (point-max) file)) + (write-region (point-min) (point-max) file) (file-error (message "Can't write %s" file))) (kill-buffer (current-buffer)) (unless save-place-quiet