2013-02-06 213 views
10

給定一個使用git format-patch(統一補丁格式)創建的diff文件,我該如何在emacs中加載同一個文件,以便我可以使用Cc Cc轉到文件中的相應位置,即使文件或目錄名稱在Windows上包含一個空格。如何使用帶有空格的emacs diff?

我的項目包含很多包含空格的文件和目錄名稱。

+1

聽起來像你應該提交一個錯誤?它應該工作,即使在Windows上。 – tripleee

+0

即使這是一個錯誤,應該有一個解決方法。 – Arafangion

+0

當我嘗試此操作時,出現錯誤「無法找到文件的開頭」。這是你得到的嗎? – razeh

回答

3

這似乎是Emacs中的一個錯誤。 下面是這似乎幫我修復補丁:

=== 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 

我將它提交到Emacs的BZR源代碼樹是否會有沒有異議。

+0

對不起,延遲,但你的補丁是有道理的,而不僅僅是空白分隔你是在相關的情況下不用製表符分隔當我能夠測試它時,我會考慮增加一個賞金。 :) – Arafangion

相關問題