[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: [PATCH] Don’t run smerge multiple times
From: |
Stefan Monnier |
Subject: |
Re: Fwd: [PATCH] Don’t run smerge multiple times |
Date: |
Wed, 18 Mar 2020 10:20:19 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Matthew Bauer [2020-03-17 20:07:25] wrote:
>> This sounds like a problem in itself.
>> Or is it really because the file gets modified multiple times?
> I think it is caused by each edit.
I see, thanks.
> At least the symptom is that after so much idle time,
> vc-git-find-file-hook gets run. Now that I'm looking for it, I don't
> actually see vc-git-find-file-hook is added to any hooks, so something
> seems off. It may be some kind of interaction with Magit that sets
> this up.
`vc-git-find-file-hook` is run by `vc-refresh-state`:
[...]
(vc-call-backend backend 'find-file-hook)
[...]
and `vc-refresh-state` is on `find-file-hook`.
This is true regardless of Magit.
>>> Related to
>>> https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02201.html
>
>> That patch was never installed. Has that problem been
>> fixed/circumvented some other way?
>
> It looks like it was fixed in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21559 in a different way.
Good, thanks. I think the original patch's intent was good, tho.
I installed the patch below into `master`.
Stefan
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 85868b91ec..d0a83fd7c4 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1429,15 +1429,16 @@ smerge-mode
(smerge-remove-props (point-min) (point-max))))
;;;###autoload
-(defun smerge-start-session ()
+(defun smerge-start-session (&optional interactively)
"Turn on `smerge-mode' and move point to first conflict marker.
If no conflict maker is found, turn off `smerge-mode'."
- (interactive)
- (smerge-mode 1)
- (condition-case nil
- (unless (looking-at smerge-begin-re)
- (smerge-next))
- (error (smerge-auto-leave))))
+ (interactive "p")
+ (when (or (null smerge-mode) interactively)
+ (smerge-mode 1)
+ (condition-case nil
+ (unless (looking-at smerge-begin-re)
+ (smerge-next))
+ (error (smerge-auto-leave)))))
(defcustom smerge-change-buffer-confirm t
"If non-nil, request confirmation before moving to another buffer."