Given a diff file created using git format-patch (in unified patch format), how do I load that same file in emacs such that I can use C-c C-c to go to the respective location in the file, even if the file or directory name contains a space, on windows.
My project contains a lot of file and directory names that contain spaces.
This does appear to be a bug in Emacs. Here is a patch which appears to fix it for me:
=== modified file 'lisp/vc/diff-mode.el'
--- lisp/vc/diff-mode.el 2013-01-02 16:13:04 +0000
+++ lisp/vc/diff-mode.el 2013-02-26 05:08:48 +0000
@@ -821,9 +821,11 @@ If the OLD prefix arg is passed, tell th
(progn (diff-hunk-prev) (point))
(error (point-min)))))
(header-files
- (if (looking-at "[-*][-*][-*] \\(\\S-+\\)\\(\\s-.*\\)?\n[-+][-+][-+] \\(\\S-+\\)")
- (list (if old (match-string 1) (match-string 3))
- (if old (match-string 3) (match-string 1)))
+ ;; handle filenames with spaces;
+ ;; cf. diff-font-lock-keywords / diff-file-header-face
+ (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)")
+ (list (if old (match-string 1) (match-string 2))
+ (if old (match-string 2) (match-string 1)))
(forward-line 1) nil)))
(delq nil
(append
I will commit it to the Emacs bzr source tree if there will be no objections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With