From f262b5b80f61f2232fe08eb8b0f8a24ad08f7943 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 10 Jan 2008 01:55:24 +0000 Subject: [PATCH] (select-safe-coding-system): When a buffer is modified, cancel the writing. --- lisp/international/mule-cmds.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 06473497c2e..ad9f73bcb43 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