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

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

bug#46876: closed ([PATCH] Find conflict markers in opened buffers as we


From: GNU bug Tracking System
Subject: bug#46876: closed ([PATCH] Find conflict markers in opened buffers as well)
Date: Tue, 09 Mar 2021 02:52:01 +0000

Your message dated Tue, 9 Mar 2021 04:51:00 +0200
with message-id <c113b756-e5a9-f79f-75c0-373985410042@yandex.ru>
and subject line Re: bug#46876: [PATCH] Find conflict markers in opened buffers 
as well
has caused the debbugs.gnu.org bug report #46876,
regarding [PATCH] Find conflict markers in opened buffers as well
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
46876: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46876
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] Find conflict markers in opened buffers as well Date: Tue, 2 Mar 2021 19:23:49 +0300
Call to (vc-find-conflicted-file) will only result in jump to a conflict
marker when file is a newly opened one. When a file is already open in
Emacs, (vc-find-conflicted-file) only switches to that buffer, so we
need to explicitly jump to a conflict marker.

* lisp/vc/smerge-mode.el (smerge-vc-next-conflict): Search for a
conflict marker if call to (vc-find-conflicted-file) haven't resulted in
a jump to one.
---
 lisp/vc/smerge-mode.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 782c799273..383f8435f5 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1468,8 +1468,10 @@ smerge-vc-next-conflict
          (if (and (buffer-modified-p) buffer-file-name)
              (save-buffer))
          (vc-find-conflicted-file)
-         (when (eq buffer (current-buffer))
-           ;; Try to find a conflict marker in current file above the point.
+         ;; At this point, the caret will only be at a conflict marker
+         ;; if the file did not correspond to an opened
+         ;; buffer. Otherwise, we need to jump to a marker explicitly.
+         (unless (looking-at "^<<<<<<<")
            (let ((prev-pos (point)))
              (goto-char (point-min))
              (unless (ignore-errors (not (smerge-next)))
-- 
2.30.1




--- End Message ---
--- Begin Message --- Subject: Re: bug#46876: [PATCH] Find conflict markers in opened buffers as well Date: Tue, 9 Mar 2021 04:51:00 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1
On 02.03.2021 21:40, Konstantin Kharlamov wrote:
Call to (vc-find-conflicted-file) will only result in jump to a conflict
marker when file is a newly opened one. When a file is already open in
Emacs, (vc-find-conflicted-file) only switches to that buffer, so we
need to explicitly jump to a conflict marker.

* lisp/vc/smerge-mode.el (smerge-vc-next-conflict): Search for a
conflict marker if call to (vc-find-conflicted-file) haven't resulted in
a jump to one. And remove `buffer` variable that becomes unused.

Thank you, this makes sense. Applied and pushed to master.

This part is suboptimal:

> When a file is already open in
> Emacs, (vc-find-conflicted-file) only switches to that buffer

...and I had to spend some time figuring out why that happens (hint: vc-git-find-file-hook), and that kind of unpredictable behavior is Not Good(tm).

I don't have an alternative fix to propose, though. At least not at this time.


--- End Message ---

reply via email to

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