jed-users mailing list

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

RE: [jed] help for diff mode (syntax color via dfa)


> -----Original Message-----
> From: Jörg Sommer
> Sent: Saturday, April 21, 2007 6:44 PM
> Subject: Re: [jed] help for diff mode (syntax color via dfa)
> 
> Hello SANGOI,
> 
> SANGOI DINO LEONARDO <SANGOID@xxxxxxxxxxxxxxxxx> wrote:
> > Well, I have my awfully outdated pages about jed on
> > http://www.paneura.com/~dino/.
> >
> > I've checked and it seems that I never put diffmode on my site...
> 
> What's your background color? My background is black and lightgray on
> cyan is a bad combination. Can you change it?

Well, I also have a black background... yes I agree that lightgray on cyan
is not beatiful... I simply wrote it with some random colors and never
bothered to change it...

If you have a less shocking combination I will gladly put it as default.
Anyways, I used 'custom_color()' to allow user customisation: you can put
in your .jedrc a set of 'custom_color()' calls. So, for example, if you put
this:

custom_color("diff_block",   "lightgray", "brown");

You will have lightgray on brown.

> 
> I saw in the source code you use if (_jed_version >= XY). Don't you think
> a #ifeval or #if () is better, especially in the setup_dfa_callback()?

Well, I used if () instead of #if (or #ifeval) mostly because there are some
problems with slang1 and complex #if test (see the thread starting at
http://ruptured-duck.com/jed-users/msg00678.html).

The last time I tested diffmode with and old jed version was a lot of time
ago... so I don't know if it still works...

> After a ^V the editing point is at the end of the +++ line. It would be
> more pleasant if the point doesn't move.

It took me a while to understand what your problem was... this is because I
always use walk_backward() to return to the diff file...

Yes, you're right, not only, looking at this and at the next question below,
I noticed that read_file() returns a value not read, so right now I'm
leaking the return code to the stack. 
A patch to fix it is attached.

-------- cut here
Index: diffmode.sl
===================================================================
--- diffmode.sl	(revision 44)
+++ diffmode.sl	(working copy)
@@ -511,6 +511,7 @@
 	variable delta = what_line();
 	% FIXME: Consider Added and removed lines while computing delta.
 	walk_mark_current_position();
+	push_spot(); % save current position
 	diff_top_of_block();
 	delta -= what_line();
 	line_as_string(); % on stack
@@ -526,11 +527,19 @@
 	name = line_as_string();
 	newpos = is_substr(name, "\t") - 2;
 	name = name[[4:newpos]];
-	read_file(name);
-	goto_line(oldpos);
-	message(name+":"+string(oldpos));
-	walk_goto_current_position();
-	walk_store_marked_position();
+	pop_spot(); % restore point position
+	if (read_file(name) == 1)
+	{
+		goto_line(oldpos);
+		message(name+":"+string(oldpos));	   
+		walk_goto_current_position();
+		walk_store_marked_position();
+	}
+	else
+	{
+		walk_return_to_marked_position();
+		message("diffmode: file '"+name+"' not found");
+	}
 }
 
 %%%%}}}
-------- cut here

(I will put a patched version on my site as soon as I can).

> 
> diffmode doesn't find the file, because it's in the wrong directory. How
> can I change the directory? Do you have some kind of strip level like -p
> for patch?

Yes, the problem is that diffmode doesn't try hard enough to find the
file... well, it does very little: a simple read_file().

A more advanced way should be nice, e.g. asking the user how many
directories strip from the name, or what directories to add, or even better
let the user browse for the file...

Almost everything would be better that wath it does now, so I accept
patches! :-)

Thanks,
					Dino



--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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