Hello,

I've noticed two problems with ediff.

* It has a problem with spaces in file names
Ediff mistakes the space for the file name/date separator.  I've changed
it to look for a tab instead, which worked in my case.  But I don't know
if the tab is guaranteed by the diff format and hence whether this is safe
to do.

Incidentally, diff-font-lock-keywords exhibits the same problem


* Applying a patch with relative file names to a directory using
ediff-patch-file will look for the relative file names in the directory of
the patch instead of the to-be-patched directory.  That means, unless
those are equal, ediff will unnecessarily prompt for the path of every
file.

Small patches are attached for both.


Regards,
Nikolaj Schumacher

diff -rdU8 lisp_orig/diff-mode.el lisp/diff-mode.el
--- lisp/diff-mode.el	2007-02-25 18:16:25.000000000 +0100
+++ lisp/diff-mode.el	2007-02-25 17:59:32.000000000 +0100
@@ -333,17 +333,17 @@
   `(("^\\(@@ -[0-9,]+ \\+[0-9,]+ @@\\)\\(.*\\)$"          ;unified
      (1 diff-hunk-header-face) (2 diff-function-face))
     ("^\\(\\*\\{15\\}\\)\\(.*\\)$"                        ;context
      (1 diff-hunk-header-face) (2 diff-function-face))
     ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context
     ("^--- .+ ----$"             . diff-hunk-header-face) ;context
     ("^[0-9,]+[acd][0-9,]+$"     . diff-hunk-header-face) ;normal
     ("^---$"                     . diff-hunk-header-face) ;normal
-    ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\)\\(.*[^*-]\\)?\n"
+    ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\([^\t]+\\)\\(.*[^*-]\\)?\n"
      (0 diff-header-face) (2 diff-file-header-face prepend))
     ("^\\([-<]\\)\\(.*\n\\)"
      (1 diff-indicator-removed-face) (2 diff-removed-face))
     ("^\\([+>]\\)\\(.*\n\\)"
      (1 diff-indicator-added-face) (2 diff-added-face))
     ("^\\(!\\)\\(.*\n\\)"
      (1 diff-indicator-changed-face) (2 diff-changed-face))
     ("^Index: \\(.+\\).*\n"
diff -rdU8 lisp_orig/ediff-ptch.el lisp/ediff-ptch.el
--- lisp/ediff-ptch.el	2007-02-25 18:16:25.000000000 +0100
+++ lisp/ediff-ptch.el	2007-02-25 18:11:11.000000000 +0100
@@ -311,22 +311,23 @@
                          (file-exists-p base-dir1))
                 (message "(file-exists-p base-dir2) %s"
                          (file-exists-p base-dir2))
 		;; If both base-dir1 and base-dir2 are relative and exist,
 		;; assume that
 		;; these dirs lead to the actual files starting at the present
 		;; directory. So, we don't strip these relative dirs from the
 		;; file names. This is a heuristic intended to improve guessing
-		(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)))
+                (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 ""))
+			base-dir2 "")))
 		(or (string= (car proposed-file-names) "/dev/null")
 		    (setcar proposed-file-names
 			    (ediff-file-name-sans-prefix
 			     (car proposed-file-names) base-dir1)))
 		(or (string=
 		     (cdr proposed-file-names) "/dev/null")
 		    (setcdr proposed-file-names
 			    (ediff-file-name-sans-prefix
--- ediff-ptch.el	2007-02-25 18:10:42.000000000 +0100
+++ ediff-ptch.el	2007-02-25 18:11:11.000000000 +0100
@@ -311,22 +311,23 @@
                          (file-exists-p base-dir1))
                 (message "(file-exists-p base-dir2) %s"
                          (file-exists-p base-dir2))
 		;; If both base-dir1 and base-dir2 are relative and exist,
 		;; assume that
 		;; these dirs lead to the actual files starting at the present
 		;; directory. So, we don't strip these relative dirs from the
 		;; file names. This is a heuristic intended to improve guessing
-		(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)))
+                (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 ""))
+			base-dir2 "")))
 		(or (string= (car proposed-file-names) "/dev/null")
 		    (setcar proposed-file-names
 			    (ediff-file-name-sans-prefix
 			     (car proposed-file-names) base-dir1)))
 		(or (string=
 		     (cdr proposed-file-names) "/dev/null")
 		    (setcdr proposed-file-names
 			    (ediff-file-name-sans-prefix
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to