<<< Date Index >>>     <<< Thread Index >>>

Re: How to copy with badly wrapped lines in pager



David Champion wrote:
> For this kind of scenario I've created a display-filter that I
> activate with a macro

Quite interesting trick!  Here are my results trying to apply it.


> macro   pager   \Cr     "<enter-command>set 
> display_filter=\"display-filter\"<enter><display-message><enter-command>unset 
> display_filter<enter>" "Reflow formatting"

Problem #1: <display-message> doesn't exist in the pager. 
(I'm using Mutt from Debian testing, apparently 1.5.6+20040907i CVS)

Solution: exit the message and the re-enter it:

macro pager \Cr ":set display_filter=display-filter\nq\n:unset display_filter\n"
                                                     ^

(lol.. cue readable vs. short macro lines flamewar :)


> My $PARINIT is set: PARINIT="rTbgqR B=.,?!_A_a Q=_s>|+" .  You'll want
> something similar if you use that filter.

Alright, so I did this:

          #!/usr/bin/perl
          
          use strict;
          
          while (<STDIN>) {
                  print;
                  last if (/^$/);
          }
          
        + $ENV{PARINIT} = 'rTbgqR B=.,?!_A_a Q=_s>|+';
          open (OUT, "| par") or *OUT = *STDOUT;
          while (<STDIN>) {
                  print OUT "$_";
          }
          close(OUT);

Problem #2: sometimes par stops in the middle of a message with the
error "par error: Word too long".  Ironically, your message (the one I'm
replying to) generates this very error! :)

For this one I don't have a solution, because I don't know par.

Any suggestion?


Toby

-- 
One theory states that if anyone ever learns how to use all of Emacs, it
will instantly disappear and be replaced by something even more bizarre
and inexplicable. Another theory states that that's how VI was invented.