[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10827: 24.0.93; M-RET behaviour with M-x diff-buffer-with-file RET
From: |
Jambunathan K |
Subject: |
bug#10827: 24.0.93; M-RET behaviour with M-x diff-buffer-with-file RET |
Date: |
Thu, 22 Mar 2012 20:40:24 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (windows-nt) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 1. Make some modification to a file and don't save it.
>> 2. Do M-x diff-buffer-with-file RET.
>> 3. Pick a modified line and press M-RET.
>> 4. Now the user is prompted for a file.
>
> When I try it, Emacs just jumps to the corresponding line in the
> original buffer without prompting the user for a file name.
> Could the problem be triggered by some particular customization
> of yours? (I.e. try to reproduce it with "emacs -Q" and if the problem
> doesn't appear there, try to figure out which part of your config
> triggers the problem).
I am on Windows + Cygwin. The immediate problem seems to be that
`diff-hunk-file-names' assumes that file names have no spaces.
If I (blindly) modify the following regexp in `diff-hunk-file-names'
--8<---------------cut here---------------start------------->8---
"[-*][-*][-*] \\(\\S-+\\)\\(\\s-.*\\)?\n[-+][-+][-+] \\(\\S-+\\)"
--8<---------------cut here---------------end--------------->8---
to
--8<---------------cut here---------------start------------->8---
"[-*][-*][-*] \\(.+\\)\\(\\s-.*\\)?\n[-+][-+][-+] \\(.+\\)"
^^^^^^^^ ^^^^^^^^^
--8<---------------cut here---------------end--------------->8---
I get the right behaviour.
Down below is a *Diff* buffer that I get with `diff-buffer-with-file'.
With re-builder, you can see that the first regexp fails to "collect"
the files correctly. The regexp (incorrectly) matches only part of the
filename/buffer name and not the whole name.
I also have my doubts regarding the correctness of another regexp
towards the end of `diff-hunk-file-names' which looks like this.
--8<---------------cut here---------------start------------->8---
"^diff \\(-\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?"
--8<---------------cut here---------------end--------------->8---
In summary, review the regexps in lisp/vc/diff-mode.el so that they do
the right thing on Windows where filenames can have spaces.
--8<---------------cut here---------------start------------->8---
diff -pub -L c\:/Documents\ and\ Settings/kjambunathan/My\ Documents/My\
Data/devel/devel-notes.org -L \#\<buffer\ devel-notes.org\> c\:/Documents\ and\
Settings/kjambunathan/My\ Documents/My\ Data/devel/devel-notes.org
c\:/Documents\ and\ Settings/kjambunathan/My\ Documents/My\
Data/tmp/buffer-content-3804sEa
--- c:/Documents and Settings/kjambunathan/My Documents/My
Data/devel/devel-notes.org
+++ #<buffer devel-notes.org>
@@ -4,6 +4,7 @@
+
http://cygwin.com/ml/cygwin/2006-05/msg00756.html
# texi to pdf conversion using miktex
Diff finished. Thu Mar 22 20:04:55 2012
--8<---------------cut here---------------end--------------->8---