From 5b10ca8f4f70cbdc51970b8b756d11f1dbf6e2f6 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 16 Feb 2021 12:49:30 +0100 Subject: make smerge-vc-next-conflict wrap around * lisp/vc/smerge-mode.el: (smerge-vc-next-conflict): While searching for conflict markers, wrap search around if current file is the last one with conflicts (bug#46538). --- lisp/vc/smerge-mode.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lisp/vc/smerge-mode.el') diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index c66a4fb2d6a..782c799273c 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1468,12 +1468,12 @@ found, uses VC to try and find the next file with conflict." (if (and (buffer-modified-p) buffer-file-name) (save-buffer)) (vc-find-conflicted-file) - (if (eq buffer (current-buffer)) - ;; Do nothing: presumably `vc-find-conflicted-file' already - ;; emitted a message explaining there aren't any more conflicts. - nil - (goto-char (point-min)) - (smerge-next))))))) + (when (eq buffer (current-buffer)) + ;; Try to find a conflict marker in current file above the point. + (let ((prev-pos (point))) + (goto-char (point-min)) + (unless (ignore-errors (not (smerge-next))) + (goto-char prev-pos))))))))) (provide 'smerge-mode) -- cgit v1.2.3 From 40d8f83e53ba64355035da78967c994d09a7802d Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 9 Mar 2021 04:47:49 +0200 Subject: smerge-vc-next-conflict: Move to conflict markers more reliably * 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. --- lisp/vc/smerge-mode.el | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'lisp/vc/smerge-mode.el') diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 782c799273c..694d4529b97 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1450,30 +1450,31 @@ If no conflict maker is found, turn off `smerge-mode'." First tries to go to the next conflict in the current buffer, and if not found, uses VC to try and find the next file with conflict." (interactive) - (let ((buffer (current-buffer))) - (condition-case nil - ;; FIXME: Try again from BOB before moving to the next file. - (smerge-next) - (error - (if (and (or smerge-change-buffer-confirm - (and (buffer-modified-p) buffer-file-name)) - (not (or (eq last-command this-command) - (eq ?\r last-command-event)))) ;Called via M-x!? - ;; FIXME: Don't emit this message if `vc-find-conflicted-file' won't - ;; go to another file anyway (because there are no more conflicted - ;; files). - (message (if (buffer-modified-p) - "No more conflicts here. Repeat to save and go to next buffer" - "No more conflicts here. Repeat to go to next buffer")) - (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. - (let ((prev-pos (point))) - (goto-char (point-min)) - (unless (ignore-errors (not (smerge-next))) - (goto-char prev-pos))))))))) + (condition-case nil + ;; FIXME: Try again from BOB before moving to the next file. + (smerge-next) + (error + (if (and (or smerge-change-buffer-confirm + (and (buffer-modified-p) buffer-file-name)) + (not (or (eq last-command this-command) + (eq ?\r last-command-event)))) ;Called via M-x!? + ;; FIXME: Don't emit this message if `vc-find-conflicted-file' won't + ;; go to another file anyway (because there are no more conflicted + ;; files). + (message (if (buffer-modified-p) + "No more conflicts here. Repeat to save and go to next buffer" + "No more conflicts here. Repeat to go to next buffer")) + (if (and (buffer-modified-p) buffer-file-name) + (save-buffer)) + (vc-find-conflicted-file) + ;; 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))) + (goto-char prev-pos)))))))) (provide 'smerge-mode) -- cgit v1.2.3 From 4b729ff60887f2de320a99cf1fb4c734d1145b00 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 4 Aug 2021 23:43:21 +0300 Subject: * lisp/vc/smerge-mode.el (smerge-mode-menu): Add menu item for smerge-refine. --- lisp/vc/smerge-mode.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lisp/vc/smerge-mode.el') diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 694d4529b97..956d9b38017 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -214,6 +214,9 @@ Used in `smerge-diff-base-upper' and related functions." ["Invoke Ediff" smerge-ediff :help "Use Ediff to resolve the conflicts" :active (smerge-check 1)] + ["Refine" smerge-refine + :help "Highlight different words of the conflict" + :active (smerge-check 1)] ["Auto Resolve" smerge-resolve :help "Try auto-resolution heuristics" :active (smerge-check 1)] -- cgit v1.2.3