From 86c3a9fbd94ebdd7c4c8ddc2e671290327eefe2c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 27 Dec 2007 10:28:28 +0000 Subject: [PATCH] (select-safe-coding-system): When a buffer is modfied, cancel the writing. --- lisp/ChangeLog | 5 +++++ lisp/international/mule-cmds.el | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4904dff206b..0de84114ed5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-12-27 Kenichi Handa + + * international/mule-cmds.el (select-safe-coding-system): When a + buffer is modfied, cancel the writing. + 2007-12-26 Eric S. Raymond * log-view.el: Add Subversion and Mercurial log format samples. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 77ef1f9cd40..f8dc141943f 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -966,6 +966,7 @@ It is highly recommended to fix it before writing to a file." (let ((codings (find-coding-systems-region from to)) (coding-system nil) + (tick (if (not (stringp from)) (buffer-modified-tick))) safe rejected unsafe) (if (eq (car codings) 'undecided) ;; Any coding system is ok. @@ -1030,6 +1031,8 @@ It is highly recommended to fix it before writing to a file." %s specified by file contents. Really save (else edit coding cookies \ and try again)? " coding-system auto-cs)) (error "Save aborted")))) + (when (and tick (/= tick (buffer-modified-tick))) + (error "Cancelled because the buffer was modified")) coding-system))) (setq select-safe-coding-system-function 'select-safe-coding-system) -- 2.39.2