jed-users mailing list

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

Re: pop_spot(0)


Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:

>This part will be called very often, so I need the best(tm) way.

>Background: I need somewhat like find the left or right parenthesis of
>the block I'm in.

The functions find_matching_delimiter() and parse_to_point() -- both
refer to the current syntax -- seem to be best suited for this kind of
tasks.

Nevertheless, for parsing html I found it easier to use the elementary
functions like fsearch() and skip_chars(). To keep track of the buffer
positions I 'invented' the following three functions:

% buffer position
static define pos_cur() %                                              %{{{
{
   return [what_line(),_get_point()];
}
%}}}
static define pos_set( p) %                                            %{{{
{
   goto_line( p[0]);
   _set_point( p[1]);
}
%}}}
static define pos_cmp( a, b) %                                         %{{{
{
   if ( a[0] == b[0]) return ( a[1] -b[1]);

   return ( a[0] -b[0]);
}
%}}}

With narrow/widen I encountered a small problem when used
with buffers visible in two windows: the current position in the
other window got lost. Maybe there is a solution for that, I did
not investigate it further.

Finally I am not sure whether my approach with these pos_*()
functions could be realised easier or faster. In any case I would
appreciate to have such a functionality built in.

Just my € 0.02.

-- 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>.


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