;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts
-;; Copyright (C) 1999, 2000, 01, 03, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@cs.yale.edu>
;; Keywords: revision-control merge diff3 cvs conflict
(defcustom smerge-diff-switches
(append '("-d" "-b")
(if (listp diff-switches) diff-switches (list diff-switches)))
- "*A list of strings specifying switches to be be passed to diff.
+ "*A list of strings specifying switches to be passed to diff.
Used in `smerge-diff-base-mine' and related functions."
:group 'smerge
:type '(repeat string))
:group 'smerge
:type 'boolean)
-(defface smerge-mine-face
- '((((background light))
+(defface smerge-mine
+ '((((min-colors 88) (background light))
+ (:foreground "blue1"))
+ (((background light))
(:foreground "blue"))
+ (((min-colors 88) (background dark))
+ (:foreground "cyan1"))
(((background dark))
(:foreground "cyan")))
"Face for your code."
:group 'smerge)
-(defvar smerge-mine-face 'smerge-mine-face)
+;; backward-compatibility alias
+(put 'smerge-mine-face 'face-alias 'smerge-mine)
+(defvar smerge-mine-face 'smerge-mine)
-(defface smerge-other-face
+(defface smerge-other
'((((background light))
(:foreground "darkgreen"))
(((background dark))
(:foreground "lightgreen")))
"Face for the other code."
:group 'smerge)
-(defvar smerge-other-face 'smerge-other-face)
-
-(defface smerge-base-face
- '((((background light))
+;; backward-compatibility alias
+(put 'smerge-other-face 'face-alias 'smerge-other)
+(defvar smerge-other-face 'smerge-other)
+
+(defface smerge-base
+ '((((min-colors 88) (background light))
+ (:foreground "red1"))
+ (((background light))
(:foreground "red"))
(((background dark))
(:foreground "orange")))
"Face for the base code."
:group 'smerge)
-(defvar smerge-base-face 'smerge-base-face)
+;; backward-compatibility alias
+(put 'smerge-base-face 'face-alias 'smerge-base)
+(defvar smerge-base-face 'smerge-base)
-(defface smerge-markers-face
+(defface smerge-markers
'((((background light))
(:background "grey85"))
(((background dark))
(:background "grey30")))
"Face for the conflict markers."
:group 'smerge)
-(defvar smerge-markers-face 'smerge-markers-face)
+;; backward-compatibility alias
+(put 'smerge-markers-face 'face-alias 'smerge-markers)
+(defvar smerge-markers-face 'smerge-markers)
(easy-mmode-defmap smerge-basic-map
`(("n" . smerge-next)
;; Out of range
(popup-menu smerge-mode-menu)
;; Install overlay.
- (setq o (make-overlay (match-beginning i) (match-end i)))
+ (setq o (make-overlay (match-beginning i) (match-end i)))
(unwind-protect
(progn
(overlay-put o 'face 'highlight)
;; handle the various conflict styles
(cond
+ ((save-excursion
+ (goto-char mine-start)
+ (re-search-forward smerge-begin-re end t))
+ ;; There's a nested conflict and we're after the the beginning
+ ;; of the outer one but before the beginning of the inner one.
+ (error "There is a nested conflict"))
+
((re-search-backward smerge-base-re start t)
;; a 3-parts conflict
(set (make-local-variable 'smerge-conflict-style) 'diff3-A)
(unwind-protect
(add-text-properties start end smerge-text-properties)
(restore-buffer-modified-p m)))
-
+
(store-match-data (list start end
mine-start mine-end
base-start base-end
Returns non-nil if a match is found between the point and LIMIT.
The point is moved to the end of the conflict."
(when (re-search-forward smerge-begin-re limit t)
- (ignore-errors
- (smerge-match-conflict)
- (goto-char (match-end 0)))))
+ (condition-case err
+ (progn
+ (smerge-match-conflict)
+ (goto-char (match-end 0)))
+ (error (smerge-find-conflict limit)))))
(defun smerge-diff (n1 n2)
(smerge-match-conflict)
(define-minor-mode smerge-mode
"Minor mode to simplify editing output from the diff3 program.
\\{smerge-mode-map}"
- nil " SMerge" nil
+ :group 'smerge :lighter " SMerge"
(when (and (boundp 'font-lock-mode) font-lock-mode)
(set (make-local-variable 'font-lock-multiline) t)
(save-excursion
(provide 'smerge-mode)
-;;; arch-tag: 605c8d1e-e43d-4943-a6f3-1bcc4333e690
+;; arch-tag: 605c8d1e-e43d-4943-a6f3-1bcc4333e690
;;; smerge-mode.el ends here