summaryrefslogtreecommitdiff
path: root/lisp/vc/smerge-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc/smerge-mode.el')
-rw-r--r--lisp/vc/smerge-mode.el50
1 files changed, 27 insertions, 23 deletions
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index c66a4fb2d6a..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)]
@@ -1450,30 +1453,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)
- (if (eq buffer (current-buffer))
- ;; Do nothing: presumably `vc-find-conflicted-file' already
- ;; emitted a message explaining there aren't any more conflicts.
- nil
+ (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))
- (smerge-next)))))))
+ (unless (ignore-errors (not (smerge-next)))
+ (goto-char prev-pos))))))))
(provide 'smerge-mode)