jed-users mailing list

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

Re: format_rest_of_paragraph


On  9.01.06, John E. Davis wrote:
> Dave Kuhlman <dkuhlman@xxxxxxxxxxxxxxx> wrote:
> >    define format_rest_of_paragraph ()
> >    {
> >        push_mark();
> >        bol();
> >        push_mark();
> >        newline();
> >        call("format_paragraph");
> >        pop_mark(1);
> >        call("backward_delete_char");
> >        pop_mark(1);
> >    }

> Here is a variation on that:
> 
> define format_rest_of_paragraph ()
> {
>    push_spot ();
>    forward_paragraph ();
>    push_mark ();
>    pop_spot ();
>    narrow ();
>    call ("format_paragraph");
>    widen ();
> }

And another variation using the "mark_paragraph_hook" (of course this will
have evil side-effects, if you already defined the mark_paragraph_hook for
the current buffer).

define mark_paragraph_from_point()
{
   push_mark();
   forward_paragraph();
}

define format_paragraph_from_point()
{
   set_buffer_hook("mark_paragraph_hook", &mark_paragraph_from_point);
   call("format_paragraph");
   unset_buffer_hook("mark_paragraph_hook");
}

I will put one of these in jedmodes.sf.net/mode/txtutils/

Günter



-- 
G.Milde web.de

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


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