Good idea. Here's a next-conflict
function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:
(defun next-conflict ()
(interactive)
(let ((buffer (current-buffer)))
(when (not (smerge-next-safe))
(vc-find-conflicted-file)
(when (eq buffer (current-buffer))
(let ((prev-pos (point)))
(goto-char (point-min))
(unless (smerge-next-safe)
(goto-char prev-pos)
(message "No conflicts found")))))))
I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive. And changed behavior accordingly of the built-in emacs function with similar functional.
Might be worth noting that I looked at how smerge-next
is defined, and it is defined with easy-mmode-define-navigation
macro. As far as I look through the macro there's no way to make smerge-next
wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.