]> code.delx.au - gnu-emacs/blobdiff - lisp/smerge-mode.el
* term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
[gnu-emacs] / lisp / smerge-mode.el
index fb13d2f3f7f8d9ac3cb4453fe898e5d9aa0bcc27..a942d09c6a09a861122d2b31d99290ff0b91caa8 100644 (file)
@@ -1,17 +1,17 @@
 ;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: tools revision-control merge diff3 cvs conflict
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -47,6 +45,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+(require 'diff-mode)                    ;For diff-auto-refine-mode.
 
 
 ;;; The real definition comes later.
@@ -79,11 +78,6 @@ Used in `smerge-diff-base-mine' and related functions."
   :group 'smerge
   :type 'boolean)
 
-(defcustom smerge-auto-refine t
-  "Automatically highlight changes in detail as the user visits conflicts."
-  :group 'smerge
-  :type 'boolean)
-
 (defface smerge-mine
   '((((min-colors 88) (background light))
      (:foreground "blue1"))
@@ -261,7 +255,7 @@ Can be nil if the style is undecided, or else:
 
 ;; Define smerge-next and smerge-prev
 (easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
-  (if smerge-auto-refine
+  (if diff-auto-refine-mode
       (condition-case nil (smerge-refine) (error nil))))
 
 (defconst smerge-match-names ["conflict" "mine" "base" "other"])
@@ -460,7 +454,7 @@ BUF contains a plain diff between match-1 and match-3."
             (with-current-buffer textbuf
               (forward-line (- startline line))
               (insert "<<<<<<< " name1 "\n" othertext
-                      (if name2 (concat "||||||| " name2 "\n"))
+                      (if name2 (concat "||||||| " name2 "\n") "")
                       "=======\n")
               (forward-line lines)
               (insert ">>>>>>> " name3 "\n")
@@ -1228,9 +1222,11 @@ with a \\[universal-argument] prefix, makes up a 3-way conflict."
 (defun smerge-start-session ()
   "Turn on `smerge-mode' and move point to first conflict marker.
 If no conflict maker is found, turn off `smerge-mode'."
+  (interactive)
   (smerge-mode 1)
   (condition-case nil
-      (smerge-next)
+      (unless (looking-at smerge-begin-re)
+        (smerge-next))
     (error (smerge-auto-leave))))
 
 (provide 'smerge-mode)