bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as


From: Andreas Röhler
Subject: bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as modified
Date: Mon, 28 Mar 2016 10:09:58 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.5.0



On 27.03.2016 16:56, Eli Zaretskii wrote:
From: Óscar Fuentes <ofv@wanadoo.es>
Date: Sun, 27 Mar 2016 05:31:19 +0200
Cc: Jaakov <j_k_v@ro.ru>, 13949@debbugs.gnu.org

diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 100e2a2..9e1f430 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -804,6 +804,7 @@ fill-paragraph
    (interactive (progn
                 (barf-if-buffer-read-only)
                 (list (if current-prefix-arg 'full) t)))
+  (setq h (if (buffer-modified-p) "" (secure-hash 'md5 (current-buffer))))
    (or
     ;; 1. Fill the region if it is active when called interactively.
     (and region transient-mark-mode mark-active
@@ -862,7 +863,10 @@ fill-paragraph
                       ;; fill-region.
                       (fill-region beg end justify)
                     (fill-region-as-paragraph beg end justify))))))
-     fill-pfx)))
+     fill-pfx))
+  (when (and (not (string= h ""))
+             (string= h (secure-hash 'md5 (current-buffer))))
+    (set-buffer-modified-p nil)))
Thanks, but I'm not sure computing the hash is enough: the functions
involved in refilling can change text properties, so the test should
also account for that.




Maybe restrict the notion of changes here to all values, which an auto-save would store?







reply via email to

[Prev in Thread] Current Thread [Next in Thread]