all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthew Bauer <mjbauer95@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] Don’t run smerge multiple times
Date: Tue, 11 Feb 2020 13:55:48 -0500	[thread overview]
Message-ID: <CAFnZKr0azTk9_wE4V=8Nvthz4rHJ+Bwx4--T2u961RXCOHwKkg@mail.gmail.com> (raw)


[-- 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


             reply	other threads:[~2020-02-11 18:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 18:55 Matthew Bauer [this message]
2020-02-13 16:17 ` [PATCH] Don’t run smerge multiple times 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFnZKr0azTk9_wE4V=8Nvthz4rHJ+Bwx4--T2u961RXCOHwKkg@mail.gmail.com' \
    --to=mjbauer95@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.