-skiped over. Nil means show all regions.")
-
-
-(defsubst ediff-get-combined-region (n)
- (concat (nth 0 ediff-combination-pattern) "\n"
- (ediff-get-region-contents n 'A ediff-control-buffer)
- (nth 1 ediff-combination-pattern) "\n"
- (ediff-get-region-contents n 'B ediff-control-buffer)
- (nth 2 ediff-combination-pattern) "\n"))
-
-(defsubst ediff-make-combined-diff (regA regB)
- (concat (nth 0 ediff-combination-pattern) "\n"
- regA
- (nth 1 ediff-combination-pattern) "\n"
- regB
- (nth 2 ediff-combination-pattern) "\n"))
+skipped over. nil means show all regions."
+ :type 'boolean
+ :group 'ediff-merge
+ )
+(make-variable-buffer-local 'ediff-show-clashes-only)
+
+(defcustom ediff-skip-merge-regions-that-differ-from-default nil
+ "*If t, show only the regions that have not been changed by the user.
+A region is considered to have been changed if it is different from the current
+default (`default-A', `default-B', `combined') and it hasn't been marked as
+`prefer-A' or `prefer-B'.
+A region is considered to have been changed also when it is marked as
+as `prefer-A', but is different from the corresponding difference region in
+Buffer A or if it is marked as `prefer-B' and is different from the region in
+Buffer B."
+ :type 'boolean
+ :group 'ediff-merge
+ )
+(make-variable-buffer-local 'ediff-skip-merge-regions-that-differ-from-default)
+
+;; If ediff-show-clashes-only, check if there is no clash between the ancestor
+;; and one of the variants.
+(defsubst ediff-merge-region-is-non-clash (n)
+ (and ediff-show-clashes-only
+ (string-match "prefer" (or (ediff-get-state-of-merge n) ""))))
+
+;; If ediff-skip-changed-regions, check if the merge region differs from
+;; the current default. If a region is different from the default, it means
+;; that the user has made determination as to how to merge for this particular
+;; region.
+(defsubst ediff-skip-merge-region-if-changed-from-default-p (n)
+ (and ediff-skip-merge-regions-that-differ-from-default
+ (ediff-merge-changed-from-default-p n 'prefers-too)))
+
+
+(defun ediff-get-combined-region (n)
+ (let ((pattern-list ediff-combination-pattern)
+ (combo-region "")
+ (err-msg
+ "ediff-combination-pattern: Invalid format. Please consult the documentation")
+ region-delim region-spec)
+
+ (if (< (length pattern-list) 5)
+ (error err-msg))
+
+ (while (> (length pattern-list) 2)
+ (setq region-delim (nth 0 pattern-list)
+ region-spec (nth 1 pattern-list))
+ (or (and (stringp region-delim) (memq region-spec '(A B Ancestor)))
+ (error err-msg))
+
+ (condition-case nil
+ (setq combo-region
+ (concat combo-region
+ region-delim "\n"
+ (ediff-get-region-contents
+ n region-spec ediff-control-buffer)))
+ (error ""))
+ (setq pattern-list (cdr (cdr pattern-list)))
+ )
+
+ (setq region-delim (nth 0 pattern-list))
+ (or (stringp region-delim)
+ (error err-msg))
+ (setq combo-region (concat combo-region region-delim "\n"))
+ ))
+
+;;(defsubst ediff-make-combined-diff (regA regB)
+;; (concat (nth 0 ediff-combination-pattern) "\n"
+;; regA
+;; (nth 1 ediff-combination-pattern) "\n"
+;; regB
+;; (nth 2 ediff-combination-pattern) "\n"))