From ff70ad053c9077ef3e01047f0ab8ad3067a66646 Mon Sep 17 00:00:00 2001 From: Matthew Bauer 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