]> git.eshelyaron.com Git - emacs.git/commitdiff
(select-safe-coding-system): When a
authorKenichi Handa <handa@m17n.org>
Thu, 27 Dec 2007 10:28:28 +0000 (10:28 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 27 Dec 2007 10:28:28 +0000 (10:28 +0000)
buffer is modfied, cancel the writing.

lisp/ChangeLog
lisp/international/mule-cmds.el

index 4904dff206b9dd08b557ea8e553cdce7a1550985..0de84114ed5140fba961f40dbc301d2082f60ff7 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-27  Kenichi Handa  <handa@ni.aist.go.jp>
+
+       * international/mule-cmds.el (select-safe-coding-system): When a
+       buffer is modfied, cancel the writing.
+
 2007-12-26  Eric S. Raymond  <esr@snark.thyrsus.com>
 
        * log-view.el: Add Subversion and Mercurial log format samples.
index 77ef1f9cd40c384b684ee1652f18b8ae499dcc35..f8dc141943f42d3ab3f30e1ee156a4f8e71dc3cd 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)