changeset 79802:2fd2b52c4f9f

(select-safe-coding-system): When a buffer is modified, cancel the writing.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 10 Jan 2008 01:55:24 +0000
parents 1fc1252447c5
children 3bf0a434954a
files lisp/international/mule-cmds.el
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Wed Jan 09 17:04:59 2008 +0000
+++ b/lisp/international/mule-cmds.el	Thu Jan 10 01:55:24 2008 +0000
@@ -966,6 +966,7 @@
 
     (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 @@
 %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)