[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Curse that hunk!
From: |
Stefan Monnier |
Subject: |
Re: Curse that hunk! |
Date: |
Wed, 11 Aug 2021 17:24:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Alan Mackenzie [2021-08-11 19:53:46] wrote:
> Finding the point where a patch hunk's old lines fail to match the file
> being patched is tedious and error prone. There surely ought to be a
> Lisp program, perhaps in diff.el which would fine these differences.
[...]
> Surely there ought to be some facility like this in Emacs?
It's been on my todo-list for quite some years to provide some command
to turn a diff into an diff3 conflict (after which you can use
`smerge-mode` to do the rest of the job).
At some point I thought I had found my solution in the form of Wiggle
https://neil.brown.name/wiggle/ but when I tried it (like 10 years ago)
it either crashed or gave weird results.
I suspect that a lower-tech solution that applies to a single hunk at
a time and where the user provides manually the region covered by the
hunk should be easy enough to write, tho maybe a bit cumbersome to use
(I guess we could have a `diff-select-hunk-for-application` command
that records the hunk somewhere and then a `diff-apply-selected-hunk`
to use in the destination buffer).
Maybe a better option is to have a command which turns the hunk into an
diff3 conflict at some location that's auto-selected using a very
naive/simple algorithm, and then provide smerge commands to move the
resulting conflict.
Stefan