unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46876: [PATCH] Find conflict markers in opened buffers as well
@ 2021-03-02 16:23 Konstantin Kharlamov
  2021-03-02 19:37 ` Konstantin Kharlamov
  2021-03-02 19:40 ` Konstantin Kharlamov
  0 siblings, 2 replies; 8+ messages in thread
From: Konstantin Kharlamov @ 2021-03-02 16:23 UTC (permalink / raw)
  To: 46876

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






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

end of thread, other threads:[~2021-03-09 14:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 16:23 bug#46876: [PATCH] Find conflict markers in opened buffers as well Konstantin Kharlamov
2021-03-02 19:37 ` Konstantin Kharlamov
2021-03-02 19:52   ` Konstantin Kharlamov
2021-03-09  2:31     ` Dmitry Gutov
2021-03-02 19:40 ` Konstantin Kharlamov
2021-03-09  2:51   ` Dmitry Gutov
2021-03-09  6:32     ` Konstantin Kharlamov
2021-03-09 14:15       ` Dmitry Gutov

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).