jed-users mailing list

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

Re: [RFC/RFT] format_paragraph for JLM


On  9.09.08, Jörg Sommer wrote:
> Hallo G.,

> "G. Milde" <milde@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > On  6.09.08, Jörg Sommer wrote:
> >
> >> You have to manually bind the function to your prefered formating key
> >> (ESC q with Emacs emulation) with definekey("latex->format_paragraph",
> >> "\eq", "LaTeX").
> >
> > Why don't you use the format_paragraph_hook and its related hooks?

> What are the related hooks? par_sep, wrap_hook and wrapok_hook

This are the hooks that I change in structured_text.sl:

   set_buffer_hook("wrap_hook", &st_indent);
   set_buffer_hook("indent_hook", &st_indent);
   set_buffer_hook("backward_paragraph_hook", &st_backward_paragraph);
   set_buffer_hook("mark_paragraph_hook", "st_mark_paragraph");
   set_buffer_hook("format_paragraph_hook", "st_format_paragraph");
   set_buffer_hook("newline_indent_hook", &st_newline_and_indent);
   set_buffer_hook("par_sep", &st_is_paragraph_separator);

But you are right, only the format_paragraph_hook is needed to let the
default format_paragraph binding execute your latex->format_paragraph()
function. The remainder is to make "smart" the move-by-paragraph, the
wrapping, and the indention features.


> And I have the problem that I need to know some informations about the
> environment. Determining them for every line in indent_hook is
> expensive. 

The parse_to_point() internal function is fast.
Some caching in the indent_hook might help, if getting the remaining
info is still too slow.

> I think my formating is to complex to be done by the internal function,
> but I found format_paragraph_hook which replaces the internal
> format_paragraph.

Yes, this is the simple way to define a mode-specific format-paragraph
function without bothering about the keybinding.

Günter

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


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