]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/smerge-mode.el
Update copyright year to 2016
[gnu-emacs] / lisp / vc / smerge-mode.el
index 771281555ab054b81bbc12c4d70597a03467b8ba..489ece81bec7eef668d60c6afa4f108a979c2c8e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2016 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: vc, tools, revision control, merge, diff3, cvs, conflict
@@ -735,17 +735,17 @@ major modes.  Uses `smerge-resolve-function' to do the actual work."
          (smerge-auto-leave))))))
 
 (defun smerge-diff-base-mine ()
-  "Diff 'base' and 'mine' version in current conflict region."
+  "Diff `base' and `mine' version in current conflict region."
   (interactive)
   (smerge-diff 2 1))
 
 (defun smerge-diff-base-other ()
-  "Diff 'base' and 'other' version in current conflict region."
+  "Diff `base' and `other' version in current conflict region."
   (interactive)
   (smerge-diff 2 3))
 
 (defun smerge-diff-mine-other ()
-  "Diff 'mine' and 'other' version in current conflict region."
+  "Diff `mine' and `other' version in current conflict region."
   (interactive)
   (smerge-diff 1 3))
 
@@ -1132,6 +1132,19 @@ repeating the command will highlight other two parts."
                         (unless smerge-use-changed-face
                           '((smerge . refine) (face . smerge-refined-added))))))
 
+(defun smerge-swap ()
+  "Swap the \"Mine\" and the \"Other\" chunks.
+Can be used before things like `smerge-keep-all' or `smerge-resolve' where the
+ordering can have some subtle influence on the result, such as preferring the
+spacing of the \"Other\" chunk."
+  (interactive)
+  (smerge-match-conflict)
+  (goto-char (match-beginning 3))
+  (let ((txt3 (delete-and-extract-region (point) (match-end 3))))
+    (insert (delete-and-extract-region (match-beginning 1) (match-end 1)))
+    (goto-char (match-beginning 1))
+    (insert txt3)))
+
 (defun smerge-diff (n1 n2)
   (smerge-match-conflict)
   (smerge-ensure-match n1)