unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Don’t run smerge multiple times
@ 2020-02-11 18:55 Matthew Bauer
  2020-02-13 16:17 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Bauer @ 2020-02-11 18:55 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 384 bytes --]

autorevert ends up calling vc-git-find-file-hook multiple times. When
this happens, smerge restarts and goes to the next hunk. This is not
desired when in the middle of an edit. To fix, don’t start smerge when
smerge is already enabled.

Related to
https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02201.html

Attached is a patch that avoids this bug.

-Matthew

[-- Attachment #1.2: Type: text/html, Size: 545 bytes --]

[-- Attachment #2: 0001-Don-t-run-smerge-multiple-times.patch --]
[-- Type: text/x-patch, Size: 1316 bytes --]

From ff70ad053c9077ef3e01047f0ab8ad3067a66646 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Tue, 11 Feb 2020 13:49:17 -0500
Subject: [PATCH]  Don’t run smerge multiple times
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

autorevert ends up calling vc-git-find-file-hook multiple times. When
this happens, smerge restarts and goes to the next hunk. This is not
desired when in the middle of an edit. To fix, don’t start smerge when
smerge is already enabled.

Related to https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02201.html
---
 lisp/vc/vc-git.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 2caa287bce..7a7050a14b 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1109,8 +1109,8 @@ This prompts for a branch to merge from."
              (save-excursion
                (goto-char (point-min))
                (re-search-forward "^<<<<<<< " nil 'noerror)))
-    (smerge-start-session)
+    (unless (and (boundp 'smerge-mode) smerge-mode)
+      (smerge-start-session))
     (when vc-git-resolve-conflicts
       (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local))
     (vc-message-unresolved-conflicts buffer-file-name)))
--
2.23.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-18 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-11 18:55 [PATCH] Don’t run smerge multiple times Matthew Bauer
2020-02-13 16:17 ` Stefan Monnier
     [not found]   ` <CAFnZKr0Fij5A_Th0=LU=9-nAbFJ=8XHD9dduDmFBFZCTOJY_DA@mail.gmail.com>
2020-03-18  0:07     ` Fwd: " Matthew Bauer
2020-03-18 14:20       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).