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

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

[debbugs-tracker] bug#23824: closed (25.0.95; Prevent compare one buffer


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#23824: closed (25.0.95; Prevent compare one buffer with itself)
Date: Sun, 26 Jun 2016 02:00:02 +0000

Your message dated Sun, 26 Jun 2016 10:59:04 +0900 (JST)
with message-id <address@hidden>
and subject line 
has caused the debbugs.gnu.org bug report #23824,
regarding 25.0.95; Prevent compare one buffer with itself
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
23824: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23824
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.0.95; Prevent compare one buffer with itself Date: Wed, 22 Jun 2016 19:12:13 +0900 (JST) User-agent: Alpine 2.20 (DEB 67 2015-01-07)

When the current buffer, buf-a, is visiting FILE-B, buf-b should
be a temporary buffer on sync with FILE-B.

./emacs -r -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foo")) (find-file "/tmp/foo") (insert "bar"))'
M-: (highlight-compare-with-file "/tmp/foo") RET
n n ; Answer no to saving suggestions.
;; Current buffer content different than /tmp/foo but no face highlight-changes shown.


In GNU Emacs 25.0.95.2 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6)
Repository revision: 829733104db073f8abd67765eae162e7360281fa

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

From 47921b1f4898f9fad3acdaa15c2c70fa4b3f9061 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Wed, 22 Jun 2016 18:30:14 +0900
Subject: [PATCH] Prevent compare one buffer with itself

* lisp/hilit-chg.el (highlight-compare-with-file):
Use a new temporary buffer on sync with file-b; mark this
buffer as unmodified to prevent being prompt to save it (Bug#23824).
---
 lisp/hilit-chg.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index 8f042b6..89ca154 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -900,10 +900,18 @@ highlight-compare-with-file
   (let* ((buf-a (current-buffer))
         (file-a (buffer-file-name))
         (existing-buf (get-file-buffer file-b))
-        (buf-b (or existing-buf
-                   (find-file-noselect file-b))))
+         (buf-b (cond ((eq buf-a existing-buf)
+ (let ((buf-new (generate-new-buffer (generate-new-buffer-name + (buffer-name buf-a)))))
+                         (with-current-buffer buf-new
+                           (insert-file-contents-literally file-b)
+                           (set-buffer-modified-p nil)) buf-new))
+                      (t
+                       (or existing-buf
+                           (find-file-noselect file-b))))))
(highlight-markup-buffers buf-a file-a buf-b file-b (not existing-buf))
-    (unless existing-buf
+    (when (or (not existing-buf)
+              (eq buf-a existing-buf))
       (kill-buffer buf-b))
     ))

--
2.8.1





--- End Message ---
--- Begin Message --- Date: Sun, 26 Jun 2016 10:59:04 +0900 (JST) User-agent: Alpine 2.20 (DEB 67 2015-01-07)
Applied patch on master branch


--- End Message ---

reply via email to

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