jed-users mailing list

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

Re: Line numbers and Visible Tabs


Following up on my own mail...

It looks like you could do this using dfa_define_highlight_rule with
HAS_DFA_SYNTAX defined.

To do it using the define_syntax intrinsic would require a tweak to the
switch statement from the define_syntax function in indent.c to add
space and tab cases.  I'm not sure if this would do violence to anything
else however...  John?

OBTW - site.sl defines a custom_color function which simplifies using
the add_color_object intrinsic.

On Mon, 29 Sep 2003 18:56:52 -0400 Tom Culliton wrote:
> I was thinking more along the lines of trivially adding a couple of
> whitespace entries (say "space" and "tab") to Color_Name_Map from
> colors.c using the provided intrinsic function "add_color_object".  
> Then you could have the syntax modes use them.  I'd do more research on
> the details but I've got a bad case of "just back from vacation desk".
> 
> John can probably say of the top of his head how viable this idea is...
> 
> On Mon, 29 Sep 2003 23:59:14 +0200 Klaus Schmid wrote:
> > On September 28, 2003 6:26 PM, Robert Lillack" <rob@xxxxxxxxxx> wrote
> > 
> > > It occurs to me that a really nice and relatively straightforward way of
> > > doing this would be to use syntax coloring to show the whitespace ...
> > > Obviously it would be the background color that would be the key.  With
> > > color you could make the distinction very subtle.  For example by making
> > > the background just enough more/less red or green or blue to be obvious.
> > > 
> > > This would be even better if you could set it in an additive way, so
> > > that you could turn it on and off like a sub-mode.  However given that
> > > it could be kept very subtle, you could probably leave it on all the
> > > time without distraction or annoyance so that's not a big deal...
> > 
> > Some time ago I posted a small script to colorize spaces and tabs by
> > abusing some syntax-functions. This abusing has one drawback: the
> > colorized items in other buffers are affected by this. To avoid this, we
> > would need some additional syntax/color-objects, which are meant to
> > be used only for this purpose.
> > 
> > The following script is a rudimentary binary-mode, which needs
> > only two syntax/color-objects: one for control-chars including tab
> > and the other for ordinary text-chars including space. Maybe this
> > minimum approach can satisfy most.
> > 
> > As it is, bin_mode has to be issued a second time on the same
> > buffer to remove the side effects on syntax-colors in other mode-buffers.
> > To make it  more pleasant, bin_mode tries additionally to reset
> > the mode which was active before. Yet not elaborated:
> > useful key-bindings, e.g. goto byte-offset instead of goto line,
> > combination with find_binary_file and any file-extensions.
> > 
> > % binmode.sl
> > static variable M= "bin";
> > 
> > if (not keymap_p( M)) copy_keymap( M, "global");
> > 
> > create_syntax_table(M);
> > {
> >    variable s="", i;
> >    
> >    for (i=1;i<32;i++) s+= char(i);
> >    
> >    % text- and control-chars
> >    define_syntax( "\d032-\d999",  '0', M); % number
> >    define_syntax( s,              '+', M); % operator
> > }
> > 
> > public define bin_mode()
> > {
> >    variable m;
> >    
> >    if ((what_mode(),pop()) == M)
> >      {
> >         ()= evalfile( _Jed_Color_Scheme);
> >         @__get_reference( get_blocal_var( M));
> >         return;
> >      }
> >    
> >    m= strlow((what_mode(),pop()))+"_mode";
> >    if ( __get_reference( m) == NULL) m= "no_mode";
> >    create_blocal_var( M);
> >    set_blocal_var( m, M);
> >         
> >    set_mode( M, 0);
> >    use_keymap( M);
> >    use_syntax_table( M);
> >    
> >    % colorize text- and control-chars
> >    set_color( "number", get_color( "string"));
> >    set_color( "operator", get_color( "comment"));
> >    
> >    run_mode_hooks( M+"_mode_hook");
> > }
> > 
> > 
> > -- Klaus
> > 
> > --------------------------
> > To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
> > the word "unsubscribe" in the message body.
> > Need help? Email <jed-users-owner@xxxxxxxxxxx>.
> 
> --------------------------
> To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
> the word "unsubscribe" in the message body.
> Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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