jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: diff.sl patch


> -----Original Message-----
> From: Guenter Milde [mailto:milde@xxxxxxxxxxxxxxxxxxxx]
> Sent: martedì 3 dicembre 2002 11.52
> Subject: Re: Re: diff.sl patch

Hi Guenter, jedders.

Lately I have very little time to write slang code, this is why you don't
read me often...

> On Mon, 2 Dec 2002 18:30:01 +0200 wrote Abraham van der Merwe 
> <abz@xxxxxxxxxxxx>:
> 
> > Which diff.sl mode is that? Mine or somebody else's?
> 
> Sorry I forgot to mention, it is yours (maybe an outdated version)
> 
> 
> % -*- slang -*-
> 
> %  This file provides a mode for viewing/editing unified diffs.
> %
> %  Written by Abraham vd Merwe <abz@xxxxxxxx>
> %  Basic syntax highligting, nothing else.
> %  Last updated: 20 September 2001
> %  

If I remember correctly, Abraham did a new version a few days later, taking
some bits from my diff mode. Then I took some of his code, but I couldn't
release a working version, because it was always a bit unstable, and as I
said I had very little free time.
But as I continue to edit diffs using jed, I slowly managed to put it in a
good shape (I hope :))

So there is my current version. This has a lot of features, so consider it a
"tecnology preview" (But as I said, I use this almost daily with only some
minor glitches).

the key features are:
- Syntax highlighting, now with support for the new color objects in jed
0.9.16, but works also on older versions, using the "keyword[3-9]" hack.
AFAICS, this is the first mode posted to this mailing list to take advantage
of this new (and very cool) feature.
- Easy movement between files/hunks (goto top/bottom of a file/hunk)
- Easy to remove some file or hunk. In the second case it can optionally
rewrite the hunk headers right after the deleted one (so the patch will
apply cleanly even after the deletion!)
- You can delete/add lines to the patch, and this mode can rebuild the
headers. Note that you should really know what you are doing, this not
always leads to a valid diff.
- Custom Menu for mode, allowing easy access to the most used operations.
This includes a file listing, much like the function list in c_mode (in
fact, i took the code from cmode.sl, added in jed 0.9.16. But I don't know
to whom credits goes, as I can't find the author anywere).
- commands to go to old/new file.
- experimental tree viewer, useful for recursive diffs.

> %  hacked to work with jed 0.99.14 by Johann Botha <joe@xxxxxxxx>
> %  * added regex for standard diff output
> %  20 September 2001
> 
> The change is just one additional line
> 
> enable_dfa_syntax_for_mode(modename);
> 
> 
> BTW: I am currently working on a "unified listing mode" that 
> allows fast
> jumping to files (or places in files) (directory lists, grep 
> output, locate,
> search all, ...). Would it be an enhancement to add an option 
> to go to the
> cited lines in the original files (if present) from the diff output? 

My version has it, using as always walk.sl (attached). The trick is done in
diff_jump_to() function, so it should be very easy to change.
The same applies to navigation between tree view and files, this time the
funtion involved is difftree_goto_pos().

When using my version, is handy to have a key bound to walk_backward(). Note
also that the function diff_add_saurus_bindings() defines some bindings that
you may not like. Use that function as a template for your own version (yes,
I know that this shouldn't be there...).

Later,
						Dino

-- 
In theory, there is no difference between theory and practice.
In practice, there is.

Attachment: walk.sl
Description: Binary data

Attachment: treemode.sl
Description: Binary data

Attachment: diffmode.sl
Description: Binary data


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]