jed-users mailing list

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

Re: [Jed-users-l] How to format (wrap) many paragraphs at once?


On Wed, 20 Jul 2011 at 21:32:28 +0200, Morten Bo Johansen wrote:
> Carlos R. Mafra <crmafra2@xxxxxxxxx> wrote:
> 
> > I have recently "discovered" that hitting ESC+q in the beginning
> > of a paragraph (tested on text and tex modes) formats it -- makes
> > all lines shorter than WRAP_DEFAULT (from my .jedrc).
> 
> > Is there a way to format the whole document in a similar (or even non-similar)
> > fashion? I tried marking some region containing more than one paragraph
> > and doing ESC+q, but that didn't work.
> 
> Hello Carlos,
> 
> Place the following in your $HOME/.jedrc:
> 
>    % format all paragraphs in a file with the internal Jed function
>    % format_paragraph ()
>    define format_paragraphs ()
>    {
>       push_spot_bob ();
>       do
>         {
>            go_right_1 ();
>            ifnot (looking_at ("\n"))
>              call ("format_paragraph");
>         }
>       while (bol_fsearch ("\n"));
>       pop_spot ();
>    } 
>  
>    setkey_reserved ("format_paragraphs", "q");  % format all paragraphs
> 
> In the emacs emulation, that would translate to ctrl-c q
> 
> If you want to have control over where in the file formatting should
> begin, just omit the first and last lines in the above function.

Thanks a lot, that works by calling the function directly with 
ESC+x format_paragraphs

And now I have an idea of what to do next time.
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


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