]> git.eshelyaron.com Git - emacs.git/commitdiff
(select-safe-coding-system): When a buffer is modified, cancel the writing.
authorJuanma Barranquero <lekktu@gmail.com>
Thu, 10 Jan 2008 01:55:24 +0000 (01:55 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Thu, 10 Jan 2008 01:55:24 +0000 (01:55 +0000)
lisp/international/mule-cmds.el

index 06473497c2ef0b64840efbeb4a3991c47e9a1ff6..ad9f73bcb436b37a24f7d0c45e2b0e3d4d1ec1f2 100644 (file)
@@ -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)