;; file names. This is a heuristic intended to improve guessing
(let ((default-directory (file-name-directory filename)))
(unless (or (file-name-absolute-p base-dir1)
- (file-name-absolute-p base-dir2)
- (not (file-exists-p base-dir1))
- (not (file-exists-p base-dir2)))
- (setq base-dir1 ""
- base-dir2 "")))
+ (file-name-absolute-p base-dir2))
+ (if (and (file-exists-p base-dir1)
+ (file-exists-p base-dir2))
+ (setq base-dir1 ""
+ base-dir2 "")
+ ;; Strip possible source/destination prefixes
+ ;; such as a/ and b/ from dir names.
+ (save-match-data
+ (let ((m1 (when (string-match "^[^/]+/" base-dir1)
+ (cons (substring base-dir1 0 (match-end 0))
+ (substring base-dir1 (match-end 0)))))
+ (m2 (when (string-match "^[^/]+/" base-dir2)
+ (cons (substring base-dir2 0 (match-end 0))
+ (substring base-dir2 (match-end 0))))))
+ (when (and (file-exists-p (cdr m1))
+ (file-exists-p (cdr m2)))
+ (setq base-dir1 (car m1)
+ base-dir2 (car m2))))))))
(or (string= (car proposed-file-names) "/dev/null")
(setcar proposed-file-names
(ediff-file-name-sans-prefix
(mapc (lambda (session-info)
(let ((proposed-file-names
(ediff-get-session-objA-name session-info)))
- (if (and (string-match "^/null/" (car proposed-file-names))
- (string-match "^/null/" (cdr proposed-file-names)))
+ (if (and (string-match-p "^/null/" (car proposed-file-names))
+ (string-match-p "^/null/" (cdr proposed-file-names)))
;; couldn't intuit the file name to patch, so
;; something is amiss
(progn
(ediff-patch-file-internal
patch-buf
(if (and ediff-patch-map
- (not (string-match
+ (not (string-match-p
"^/dev/null"
;; this is the file to patch
(ediff-get-session-objA-name (car ediff-patch-map))))
target-buf buf-to-patch file-name-magic-p
patch-return-code ctl-buf backup-style aux-wind)
- (if (string-match "V" ediff-patch-options)
+ (if (string-match-p "V" ediff-patch-options)
(error
"Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))