[darcs-users] Re: an interface for splitting hunks

Jamie Webb j at jmawebb.cjb.net
Fri Apr 1 11:49:57 UTC 2005


On Fri, Apr 01, 2005 at 10:08:10AM +0200, Jean Jordaan wrote:
> Hmm. Vim (e.g.) knows where functions start/end, but that's
> because it has an intricate syntax file for the language. It
> might be painful to hobble toward something workable for darcs
> using only a pair of regexps ..

Bear in mind that this only needs to be a heuristic.

> I use Python. Function boundaries are easy to find, but they
> depend on relative indentation. Not so easy for a regexp.

I agree with Ketil. For most languages and coding styles, it would
suffice just to prefer ending a hunk with a line containing only
whitespace. As programmers and authors, we pretty much universally use
blank lines to indicate exactly the semantic boundaries that we want
darcs to recognise.

In fact, I think I'd find an option in record that broke up the
current hunk at blank lines quite useful, in order to record adjacent
added functions as separate patches. Not as useful as being able to
break hunks at arbitrary places, but much easier on the UI. Each
removed paragraph would become a separate hunk also.

Having said that, it occurs to me that ed has a pretty effective way
to select particular lines of text with an interaction style similar
to darcs. Not exactly intuitive except to vi users, but then
hunk-splitting would presumably be an advanced feature... I have a
feeling David won't go for this.

-- Jamie Webb




More information about the darcs-users mailing list