From 57775591e08125862dfbceca2894d824d7147f7c Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Thu, 9 Aug 2007 12:04:46 -0400 Subject: [PATCH] Try to fix bug with writing Muse files in different coding systems 2007-08-09 Michael Olson * lisp/muse.el (muse-write-file): Pay attention to coding-system-for-write and save-buffer-coding-system. This should fix a recently-introduced bug with writing Muse pages in different coding systems. --- ChangeLog | 7 +++++++ lisp/muse.el | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8f79442..62b49dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-08-09 Michael Olson + + * lisp/muse.el (muse-write-file): Pay attention to + coding-system-for-write and save-buffer-coding-system. This + should fix a recently-introduced bug with writing Muse pages in + different coding systems. + 2007-08-08 Michael Olson * README (Prerequisites): Fix typo. diff --git a/lisp/muse.el b/lisp/muse.el index bb0a54b..9ba2420 100644 --- a/lisp/muse.el +++ b/lisp/muse.el @@ -316,7 +316,18 @@ return non-nil." (if (not (file-exists-p buffer-file-name)) (format "Directory %s write-protected" dir) "File is write-protected")))))) - (write-region (point-min) (point-max) buffer-file-name) + (let ((coding-system-for-write + (or (and (boundp 'save-buffer-coding-system) + save-buffer-coding-system) + coding-system-for-write))) + (write-region (point-min) (point-max) buffer-file-name)) + (when (boundp 'last-file-coding-system-used) + (when (boundp 'buffer-file-coding-system-explicit) + (setq buffer-file-coding-system-explicit + last-coding-system-used)) + (if save-buffer-coding-system + (setq save-buffer-coding-system last-coding-system-used) + (setq buffer-file-coding-system last-coding-system-used))) t))))) (defun muse-collect-alist (list element &optional test) -- 2.11.4.GIT