bug#81395: 32.0.50; diff-apply-hunk should be case-sensitive

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
>> Indeed the matching is case-insensitive.  I remember making this
>> decision consciously.  ๐Ÿ™‚
>> I'm OK if you make it case-sensitive, tho.
>
> See the attached patch.

LGTM, feel free to push it.

>> I guess we could also check the "offset" between the diff's line-number
>> and the place where we found the corresponding text to see which of OLD
>> or NEW is closest to what the hunk describes (if it's exactly at the
>> right place, it's more likely to be what was meant), but if we apply
>> hunks one by one starting from the beginning, then the line numbers end
>> up not matching exactly anyway (because of the changes made from previous
>> hunks), so distrusting approximate matches is not a panacea.
>
> May we keep track of the applied hunks in some way?

I don't think it'd be worth the trouble, because diff-apply-hunk is also
very often used out of order and interspersed with other edits
and whatnot, so I think we generally don't want to behave differently
depending on whether line numbers match exactly.  It would just lead
to confusion.

I think we should push this to the UI instead.  E.g. in the case you
showed the question should be "already applied, undo instead?" but
something like "Patch applicable but could also be undone elsewhere.
Really apply?"  So the users can say `n` and then `C-u C-c C-a` if
they'd rather undo the change.

I can imagine similarly changing the IU in case where the patch can be
applied at several different places, where we'd ask the user where to
apply it.


=== Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.