Sure, the following function works for me to automatically resolve all conflicts inside a file:
(defun smerge-resolve-all-in-file-to (to-keep) "Resolves all conflicts inside a file in preference of TO-KEEP TO-KEEP decides which part to keep and is one of `upper', `lower', `base'" (interactive (list (completing-read "Keeping (upper, base, lower): " '(upper base lower)))) (let ((resolve-func (pcase to-keep ("upper" 'smerge-keep-upper) ("base" 'smerge-keep-base) ("lower" 'smerge-keep-lower) (_ (error "Unknown resolution argument!")))) (num-chars-bfore (point-max))) (save-excursion (goto-char (point-min)) (while (ignore-errors (not (smerge-next))) (funcall resolve-func))) (when (= num-chars-bfore (point-max)) (message "No conflicts were found"))))
It is interactive with autocompletion, so you can do a M-x smerge-resolve-all-file-conflicts and it will autocomplete upper, base, lower args for you.
I also sent it upstream because I often need such functional in my work, but Emacs maintainers don't want to accept it based on their claim that they never had such a need, hence people won't use it. If you want it to be in Emacs, please voice your opinion on the issue by emailing to [email protected].