emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error when applying hunk in Diff buffer


From: Stefan Monnier
Subject: Re: Error when applying hunk in Diff buffer
Date: Sat, 22 Jul 2006 16:36:54 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> The change in Emacs-22 is that the diff can be done locally 
>> (with `diff') rather than via `cvs'.  If you remove the file 
>> <foo>.~.<rev>~, then it'll force VC to ask `cvs' to do the 
>> diff and you'll get a header just like the one we get with -L 
>> (this use of -L is specifically to reproduce the header that 
>> `cvs' would have output).
>> 
>> So you'd basically have to tell VC to not use the local copy 
>> of the file in vc-diff-internal.

> As Andre suggested, setting vc-stay-local to nil solves the problem.

Using C-u C-c C-a might work as well.
After all, C-c C-a is wrong: you do not want to apply the hunk to the file
where it's not applied yet, but you want to revert it from the file where
it's already applied.  C-c C-a usually figures out what you meant, but
that's not always the case.  E.g. if the patch can be applied a second time
without conflict (maybe because the same text appears twice, or because the
context is not sufficiently specific) you may end up applying it a second
time rather than undoing it.

> Maybe vc-stay-local should be set when vc-diff-internal sets
> vc-diff-knows-L?

It'd have other unrelated side-effects, so it doesn't seem right.

> Or maybe diff-mode should be able to cope with a diff like this:

> *** ChangeLog.~1.481.~        Mon Jul 17 09:47:44 2006
> --- ChangeLog Thu Jul 20 11:59:52 2006
> ***************
> *** 1,7 ****
>   2006-07-14  Eli Zaretskii  <address@hidden>
  
>       * configure.in (PKG_CHECK_MODULES): Redirect the output of
> -     $PKG_CONFIG --exists "$2" to config.log.
>       * configure: Regenerated.
  
>   2006-07-14  Kim F. Storm  <address@hidden>
> --- 1,6 ----

> And DTRT?

Yes, maybe diff-mode could use some heuristic to decide which of the two
file names should be used.  Maybe if one of the two is a backup files (with
the ~ at the end) or if one of the two is read-only, then the default should
be to apply the hunk to the other...

But to tell you the truth, I think there's already too much heuristic involved
in diff-mode's selection of the file, place, and direction of the
hunk application.  So it's probably better to get used to telling Emacs
what you mean, rather than let Emacs figure out that you meant something
else than what you said.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]