jed-users mailing list

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

Re: is format_paragraph_hook useful?


G. Milde <g.milde@xxxxxx> wrote:
>2 Reasons:

I would also add that the hook makes it possible to write a functions
that format a paragraph without knowing what particular function is
actually performing the formatting.  For example, imagine editing a
C file that contains comments formatted according to some other mode,
e.g,

   /* mode: latex

      This bit of code returns the solution of
      the quadratic equation
      \begin{equation}
         0 = ax^2 + bx + c.
      \end{equation}
   */

When formatting the paragraph inside the comment, it would be nice to
format it as latex-mode would.  If latex-mode used a different
function for this, it would be necessary to know what that function
is, which is not always possible.  The advantage of the hook is that
it would permit something like:

   private define c_format_paragraph_hook ()
   {
      variable mode = get_comment_mode ();
      if (mode == NULL) mode = "text_mode";
      push_mode (mode);
      call ("format_paragraph");
      pop_mode ();
   }

Of course the actual function to carry out this operation would be a
bit more complicated than illustrated above, but I think that it
provides the basic idea.

--John

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