maildir (was "Re: macro help (was "Re: rot13 capability?")")

2001-09-24 Thread David T-G

Piet --

...and then Piet Delport said...
% On Sat, 22 Sep 2001 at 23:15:44 -0400, David T-G wrote:
% > ...and then Jens Paulus said...
% > % On Sat, Sep 22, 2001 at 11:41:18PM +0200, Jens Paulus wrote:
% > 
% > % to the mail separation From_ line in mbox format and inserts the
% > % quotation character itself automatically. I wonder if there is a way
% > % to
% > 
% > Sure; switch to a mail folder format that doesn't require it.  I hear
% > that maildir is good.
% 
% I switched over to Maildir a few days ago, because i liked the idea of:

Good for you!


% 
% - Not having to worry with locking.
% - One message per file, so less chance of catastrophic corruption.
%   Plus, i can go:
%   $ grep foo * | xargs rm
%   and such to process messages using shell commands.  Neat.

Yeah.  That's a nice bonus.


% - No From_ quoting or other such hacks involved.  In fact, Maildir
%   doesn't seem to use From_ lines to begin with.

It sure doesn't; that's an mbox thing.


% 
% I can highly recommend Maildir so far.  All that was involved in the
% switch was:
% 
% 1. Append a `/' to all folder names in my .procmailrc, as in:
%   :0:
%   * ^Delivered-to: mutt-users@ns\.gbnet\.net
%   in.mutt-users/
%This tells procmail to use Maildir.

procmail didn't always understand maildir; IIRC, at around 3.14 someone
wrote a patch to add maildir support, and the next version then supported
it natively.  When in doubt, upgrade or at least test.


% 
% 2. Add `mbox_type=Maildir' to my muttrc.  Not strictly required, as mutt
%will auto-detect a mailbox's type, but mutt will make all new
%mailboxes Maildir now.

Yep.


% 
% 3. Migrate my old mailboxes by renaming them to `foo.old', then going
%into them and saving them all back to `foo', creating a Maildir in
%the process.  (Is there a more convenient way to do this?)

Heh.  Of course!

  http://www.qmail.org/mbox2maildir


% 
% > % >From heaven to earth.
% > % >From alpha to omega.
% > 
% > As expected :-)
% 
% Those showed up without >'s here in the original message. :-)

*grin*


% 
% -- 
% Piet Delport <[EMAIL PROTECTED]>
% Today's subliminal thought is:


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: macro help (was "Re: rot13 capability?")

2001-09-23 Thread Piet Delport


--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, 22 Sep 2001 at 23:15:44 -0400, David T-G wrote:
> ...and then Jens Paulus said...
> % On Sat, Sep 22, 2001 at 11:41:18PM +0200, Jens Paulus wrote:
> % > On Thu, Sep 20, 2001 at 09:21:52AM -0400, David T-G wrote:
> % > > Hey, rot13 is cool.  Now for a rot13 filter in vim :-)
> % >=20
> % > >From the vim helpfile:
> %   ^
> % Hey, this is bad: what I just experienced is that after the transmission
>=20
> Well, yes and no...  It's an escape to prevent your mail agent from
> thinking that it's the start of a new message.
>=20
> % of my mail I see that there is a quotation character just before
> % 'From ' (...  the vim helpfile). I didn't put it there and it
> % doesn't come from David. Obviously the software thinks that there
> % should be a distingtion
>=20
> That's included by the MTA by design when it's delivered.
>=20
> % to the mail separation From_ line in mbox format and inserts the
> % quotation character itself automatically. I wonder if there is a way
> % to
>=20
> Sure; switch to a mail folder format that doesn't require it.  I hear
> that maildir is good.

I switched over to Maildir a few days ago, because i liked the idea of:

- Not having to worry with locking.
- One message per file, so less chance of catastrophic corruption.
  Plus, i can go:
$ grep foo * | xargs rm
  and such to process messages using shell commands.  Neat.
- No From_ quoting or other such hacks involved.  In fact, Maildir
  doesn't seem to use From_ lines to begin with.

I can highly recommend Maildir so far.  All that was involved in the
switch was:

1. Append a `/' to all folder names in my .procmailrc, as in:
:0:
* ^Delivered-to: mutt-users@ns\.gbnet\.net
in.mutt-users/
   This tells procmail to use Maildir.

2. Add `mbox_type=3DMaildir' to my muttrc.  Not strictly required, as mutt
   will auto-detect a mailbox's type, but mutt will make all new
   mailboxes Maildir now.

3. Migrate my old mailboxes by renaming them to `foo.old', then going
   into them and saving them all back to `foo', creating a Maildir in
   the process.  (Is there a more convenient way to do this?)

> % avoid that. I just made an other test with an other sentence and the
> % same result. Let's see what happens.
> %=20
> % >From heaven to earth.
> % >From alpha to omega.
>=20
> As expected :-)

Those showed up without >'s here in the original message. :-)

--=20
Piet Delport <[EMAIL PROTECTED]>
Today's subliminal thought is:

--YiEDa0DAkWCtVeE4
Content-Type: application/pgp-signature
Content-Disposition: inline

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (FreeBSD)

iD8DBQE7rk1lzRUP82sZFCcRAl4WAJ0btbWMwEDzZQUGFkET5qlGWffc7ACePEGi
QY4l/xMSYj8FY/inYdx3/BM=
=k1rX
-END PGP SIGNATURE-

--YiEDa0DAkWCtVeE4--



Re: macro help (was "Re: rot13 capability?")

2001-09-22 Thread David T-G

Jens --

...and then Jens Paulus said...
% On Sat, Sep 22, 2001 at 11:41:18PM +0200, Jens Paulus wrote:
% > On Thu, Sep 20, 2001 at 09:21:52AM -0400, David T-G wrote:
% > > Hey, rot13 is cool.  Now for a rot13 filter in vim :-)
% > 
% > >From the vim helpfile:
%   ^
% Hey, this is bad: what I just experienced is that after the transmission

Well, yes and no...  It's an escape to prevent your mail agent from
thinking that it's the start of a new message.


% of my mail I see that there is a quotation character just before 'From '
% (...  the vim helpfile). I didn't put it there and it doesn't come from
% David. Obviously the software thinks that there should be a distingtion

That's included by the MTA by design when it's delivered.


% to the mail separation From_ line in mbox format and inserts the
% quotation character itself automatically. I wonder if there is a way to

Sure; switch to a mail folder format that doesn't require it.  I hear
that maildir is good.


% avoid that. I just made an other test with an other sentence and the
% same result. Let's see what happens.
% 
% >From heaven to earth.
% >From alpha to omega.

As expected :-)


% 
% -Jens
% 

HTH & HAND


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: macro help (was "Re: rot13 capability?")

2001-09-22 Thread Jens Paulus

On Sun, Sep 23, 2001 at 03:15:29AM +0200, Piet Delport wrote:
> Vg unf znal boshfpngbel hfrf, enatvat sebz gur fvyyl gb gur fbzrjung
> frevbhf, fhpu nf cebgrpgvat fcbvyref be cbgragvnyyl bssrafvir grkg sebz
> pnfhny ernqvat va choyvp sbehzf.  (Vg'f hfrq va arjftebhcf fhpu nf
> erp.uhzbe.* sbe aba-cbyvgvpnyyl-pbeerpg wbxrf, sbe rknzcyr, gb cerirag
> pbzcynvagf.  Vs lbh'er jnearq gung gur wbxr vf cbgragvnyyl bssrafvir,
> ohg lbh jrag naq qrpelcgrq vg naljnl, ubj pna lbh pbzcynva?)
> 
> Sha snpg bs gur qnl: `iv' EBG13'q orpbzrf `vi'.

Url, gung'f ernyyl pbby. Gunax lbh sbe lbhe rkcynangvba.

> > Also, I've never used it.
> 
> Lbh unir abj. :-)

Gung'f evtug.

-Jens





Re: macro help (was "Re: rot13 capability?")

2001-09-22 Thread Jens Paulus

On Sat, Sep 22, 2001 at 11:41:18PM +0200, Jens Paulus wrote:
> On Thu, Sep 20, 2001 at 09:21:52AM -0400, David T-G wrote:
> > Hey, rot13 is cool.  Now for a rot13 filter in vim :-)
> 
> >From the vim helpfile:
  ^
Hey, this is bad: what I just experienced is that after the transmission
of my mail I see that there is a quotation character just before 'From '
(...  the vim helpfile). I didn't put it there and it doesn't come from
David. Obviously the software thinks that there should be a distingtion
to the mail separation From_ line in mbox format and inserts the
quotation character itself automatically. I wonder if there is a way to
avoid that. I just made an other test with an other sentence and the
same result. Let's see what happens.

>From heaven to earth.
>From alpha to omega.

-Jens





Re: macro help (was "Re: rot13 capability?")

2001-09-22 Thread Piet Delport

On Sat, 22 Sep 2001 at 23:41:18 +0200, Jens Paulus wrote:
> On Thu, Sep 20, 2001 at 09:21:52AM -0400, David T-G wrote:
> > Hey, rot13 is cool.  Now for a rot13 filter in vim :-)
> 
> From the vim helpfile:
> 
> [snip]
> |v_g?| {visual}g? perform rot13 encoding on highlighted text
> |g?|   g?{motion} perform rot13 encoding on the text that is moved over
>  with {motion}
> [snip]
> 
> However, I still don't know what the sense/purpose of rot13 is.

Vg unf znal boshfpngbel hfrf, enatvat sebz gur fvyyl gb gur fbzrjung
frevbhf, fhpu nf cebgrpgvat fcbvyref be cbgragvnyyl bssrafvir grkg sebz
pnfhny ernqvat va choyvp sbehzf.  (Vg'f hfrq va arjftebhcf fhpu nf
erp.uhzbe.* sbe aba-cbyvgvpnyyl-pbeerpg wbxrf, sbe rknzcyr, gb cerirag
pbzcynvagf.  Vs lbh'er jnearq gung gur wbxr vf cbgragvnyyl bssrafvir,
ohg lbh jrag naq qrpelcgrq vg naljnl, ubj pna lbh pbzcynva?)

Sha snpg bs gur qnl: `iv' EBG13'q orpbzrf `vi'.

> Also, I've never used it.

Lbh unir abj. :-)

-- 
Piet Delport <[EMAIL PROTECTED]>
Today's subliminal thought is:

 PGP signature


Re: macro help (was "Re: rot13 capability?")

2001-09-22 Thread Jens Paulus

On Thu, Sep 20, 2001 at 09:21:52AM -0400, David T-G wrote:
> Hey, rot13 is cool.  Now for a rot13 filter in vim :-)

>From the vim helpfile:

[snip]
|v_g?|   {visual}g? perform rot13 encoding on highlighted text
|g?| g?{motion} perform rot13 encoding on the text that is moved over
   with {motion}
[snip]

However, I still don't know what the sense/purpose of rot13 is.
Also, I've never used it.

-Jens





Re: macro help (was "Re: rot13 capability?")

2001-09-21 Thread David T-G

Byrial --

...and then Byrial Jensen said...
% On Thu, Sep 20, 2001 at 09:21:52 -0400, David T-G wrote:
% > % 
% > %   macro pager ,@r13on "set 
display_filter=$HOME/local/bin/rot13\nmacro pager \\cx 
,@r13off\n"
...
% 
% You can do it a little shorter as several commands can be entered at
% the same command line. "\n" can be replaced by ";" in
% the on and the off macros.

Oh, cool -- thanks!  That will make the muttrc a little more readable...


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: macro help (was "Re: rot13 capability?")

2001-09-21 Thread David T-G

Piet --

...and then Piet Delport said...
% On Thu, 20 Sep 2001 at 08:21:14 -0400, David T-G wrote:
% [...]
% > My muttrc has
% > 
% >   macro pager ,@r13on "set 
display_filter=$HOME/local/bin/rot13\nmacro pager \\cx 
,@r13off\n"
% >   macro pager ,@r13off "set display_filter=\nmacro 
pager\\cx ,@r13on\n"
% >   macro pager \cx ,@r13on   "Toggle ROT13 decoding"
% [...]
% > And why should the columns differ (example one to examples two and
% > three) and \cX lose its description?
% 
% Oops, missed that.  The description is lost every time  is
% re-defined from within the other macros.  Either add it there, or drop

Ahhh...  Yes, I see.  Thanks!

I've successfully added it back in -- and even escaped the "" around the
description to get it to work inside the macro definition "" :-)  I next
changed it to '' so that I wouldn't have to escape...


% it altogether, i think.  (Docs?  We don' need no steenkin' docs! :-)

*grin*


% 
% -- 
% Piet Delport <[EMAIL PROTECTED]>
% Today's subliminal thought is:


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: macro help (was "Re: rot13 capability?")

2001-09-20 Thread Piet Delport


--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, 20 Sep 2001 at 08:21:14 -0400, David T-G wrote:
[...]
> My muttrc has
>=20
>   macro pager ,@r13on "set display_filter=3D$HOME/local/bi=
n/rot13\nmacro pager \\cx ,@r13off\n"
>   macro pager ,@r13off "set display_filter=3D\nmacro pager\\cx ,@r13on\n"
>   macro pager \cx ,@r13on   "Toggle ROT13 decoding"
[...]
> And why should the columns differ (example one to examples two and
> three) and \cX lose its description?

Oops, missed that.  The description is lost every time  is
re-defined from within the other macros.  Either add it there, or drop
it altogether, i think.  (Docs?  We don' need no steenkin' docs! :-)

--=20
Piet Delport <[EMAIL PROTECTED]>
Today's subliminal thought is:

--7AUc2qLy4jB3hD7Z
Content-Type: application/pgp-signature
Content-Disposition: inline

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (FreeBSD)

iD8DBQE7qkwZzRUP82sZFCcRArMPAJ9/h+xzhC6Tc7uLujWyz8gZmK0SLQCgh6mZ
Ldq3zSyhNtGx2Er8eoJ2t5k=
=tGpy
-END PGP SIGNATURE-

--7AUc2qLy4jB3hD7Z--



Re: macro help (was "Re: rot13 capability?")

2001-09-20 Thread Byrial Jensen

On Thu, Sep 20, 2001 at 09:21:52 -0400, David T-G wrote:
> Hi, all --
> 
> ...and then David T-G said...
> % 
> % Hokay, so I've given this a try and it works -- once.  I can \cx to
> % rotate and \cx to unrotate but then it stops.  My muttrc has
> % 
> %   macro pager ,@r13on "set 
>display_filter=$HOME/local/bin/rot13\nmacro pager \\cx 
>,@r13off\n"
> %   macro pager ,@r13off "set display_filter=\nmacro 
>pager\\cx ,@r13on\n"
> %   macro pager \cx ,@r13on   "Toggle ROT13 decoding"

You can do it a little shorter as several commands can be entered at
the same command line. "\n" can be replaced by ";" in
the on and the off macros.



Re: macro help (was "Re: rot13 capability?")

2001-09-20 Thread David T-G

Hi, all --

...and then David T-G said...
% 
% Hokay, so I've given this a try and it works -- once.  I can \cx to
% rotate and \cx to unrotate but then it stops.  My muttrc has
% 
%   macro pager ,@r13on "set 
display_filter=$HOME/local/bin/rot13\nmacro pager \\cx 
,@r13off\n"
%   macro pager ,@r13off "set display_filter=\nmacro 
pager\\cx ,@r13on\n"
%   macro pager \cx ,@r13on   "Toggle ROT13 decoding"

Thanks to Ulf for catching my absent space in the off macro; it should be

  ... macro pager \\cx ...

instead of 

  ... macro pager\\cx ...

as I originally had it.


Hey, rot13 is cool.  Now for a rot13 filter in vim :-)

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


macro help (was "Re: rot13 capability?")

2001-09-20 Thread David T-G

Piet, et al --

...and then Piet Delport said...
% 
...
% Instead of resorting to hacks involving .mailcap and (horrors :-) editing
% the message's content type[1], you can just do something like:
% 
% macro pager ( "set display_filter=\nmacro pager \\ca 
)\n"
% macro pager ) "set display_filter=rot13\nmacro pager 
\\ca (\n"
% macro pager \ca   )   "Toggle ROT13 decoding"
% 
% (Pity there's no way to force mutt to re-parse the message... i'm using
% a double  to simulate one.)

Hokay, so I've given this a try and it works -- once.  I can \cx to
rotate and \cx to unrotate but then it stops.  My muttrc has

  macro pager ,@r13on "set 
display_filter=$HOME/local/bin/rot13\nmacro pager \\cx 
,@r13off\n"
  macro pager ,@r13off "set display_filter=\nmacro 
pager\\cx ,@r13on\n"
  macro pager \cx ,@r13on   "Toggle ROT13 decoding"

(yes, with the path hardcoded for the moment) and when I first start mutt
my pager help shows

  Help for pager -- (42%)
  ...
  ^X  M ,@r13on  Toggle ROT13 decoding
  ...
  ,@r13offmacro  set display_filter=\nmacro pager\cx ,@r13on\n
  ,@r13on macro  set display_filter=/home/david
  +  tg/local/bin/rot13\nmacro page
  +  r \cx ,@r13off\n

and then after a \cX my pager help shows

  Help for pager -- (41%)
  ...
  ^X  macro  ,@r13off
  ...
  ,@r13offmacro  set display_filter=\nmacro pager\cx ,@r13on\n
  ,@r13on macro  set display_filter=/home/david
  +  tg/local/bin/rot13\nmacro page
  +  r \cx ,@r13off\n

but the tricky part is that after another \cX my pager help still shows

  Help for pager -- (41%)
  ...
  ^X  macro  ,@r13off
  ...
  ,@r13offmacro  set display_filter=\nmacro pager\cx ,@r13on\n
  ,@r13on macro  set display_filter=/home/david
  +  tg/local/bin/rot13\nmacro page
  +  r \cx ,@r13off\n

and so I can never get back to rot13 mode unless I manually define \cX to
be ,@r13on again.  Can you see why ,@r13off isn't properly resetting \cX?
And why should the columns differ (example one to examples two and three)
and \cX lose its description?

Meanwhile, I think I may have hit on a limit in macro name length; this
didn't work with ,@rot13off so I had to shorten it a bit.  I haven't
looked yet other than briefly at the manual, which didn't mention one,
but does anyone know of a name length limit?


Thanks again, and in advance.

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: rot13 capability?

2001-09-20 Thread David T-G

Piet, et al --

...and then Piet Delport said...
% On Wed, 19 Sep 2001 at 15:09:32 -0400, David T-G wrote:
% > ...and then David Champion said...
% [snip]
% > % Guess someone just can't make up their minds. I wonder whether it's
% > % Sun or a standards agency. I wish I still had other platforms
% > 
% > Yeah.
% 
% Well, FreeBSD has the following to say under tr(1):
[snip]

Oooh; details!  Thanks so much; that's helpful and kind of brings things
together.


% (hope the URL gets through intact) ]

It did; thanks.


% 
% So, under the POSIX standard at least (and *BSD, in this case), the One
% True Way is:
% 
% tr A-Za-z N-ZA-Mn-za-m
% 
% Does that work under Solaris?

I'm sure it does under 2.6 and 8, and almost sure for 2.x* for 2 % Well, the lesson is that tr usage varies wildly among platforms,
% > % just like expr, but we already knew that. :)
% 
% That's what POSIX tries to remedy. :)

Yep :_)


% 
% > % So maybe it's best just to have your .mailcap call that rot13 shell
% > % script, and adapt the script to cope with unames appropriately. Or
% > % use perl.
% > 
% > sh is portable (see other drifted-off-topic thread :-) but with this
% > much garbage rolled in I think I will, indeed, go for perl.
% 
% Heavens man, have you no concern for efficiency? :-) If the POSIX

But perl is *fun*!


% version doesn't work under Solaris, i'd rather go for:
% 
% tr ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \
%NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm
% 
% Much more lightweight, and should work practically anywhere, even if
% it involves a bit of extra typing.

Only once, though, so typing isn't the problem.  No, this is guaranteed
to work everywhere.


% 
% Also, as for getting mutt to actually use the filter, i'm surprised no
% one has pointed at $display_filter yet.

Um, what's that?  Off to read the man pages...


% 
% Instead of resorting to hacks involving .mailcap and (horrors :-) editing
% the message's content type[1], you can just do something like:
% 
% macro pager ( "set display_filter=\nmacro pager \\ca 
)\n"
% macro pager ) "set display_filter=rot13\nmacro pager 
\\ca (\n"
% macro pager \ca   )   "Toggle ROT13 decoding"
% 
% (Pity there's no way to force mutt to re-parse the message... i'm using
% a double  to simulate one.)

Nice trick.


% 
% Just replace `rot13' with your chosen filter command and you're set;  no
% extra config required, and no risk of munging actual messages.

Excellent!  I'll change \ca to \cx (an old rn man :-) and be set, it
seems.


% 
% 
% [1] What happens if the message you're rot'ing is something besides
% text/plain, like text/html f'rinstance?  The given macro will just
% nuke the content-type from orbit, leaving you looking at HTML
% source.

I had worried about that myself, but figured I'd limit this functionality
to text-only messages and be happy I had it at all :-)  I also haven't
yet read Vineet's method for multipart mails but figured that it might
take care of that concern...


% 
% -- 
% Piet Delport <[EMAIL PROTECTED]>
% Today's subliminal thought is:


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: rot13 capability?

2001-09-19 Thread Piet Delport

On Wed, 19 Sep 2001 at 15:09:32 -0400, David T-G wrote:
> ...and then David Champion said...
[snip]
> % Guess someone just can't make up their minds. I wonder whether it's
> % Sun or a standards agency. I wish I still had other platforms
> 
> Yeah.

Well, FreeBSD has the following to say under tr(1):

| COMPATIBILITY
|  System V has historically implemented character ranges using the
|  syntax ``[c-c]'' instead of the ``c-c'' used by historic BSD
|  implementations and standardized by POSIX.  System V shell
|  scripts should work under this implementation as long as the
|  range is intended to map in another range, i.e. the command ``tr
|  [a-z] [A-Z]'' will work as it will map the ``['' character in
|  string1 to the ``['' character in string2.  However, if the shell
|  script is deleting or squeezing characters as in the command ``tr
|  -d [a-z]'', the characters ``['' and ``]'' will be included in
|  the deletion or compression list which would not have happened
|  under an historic System V implementation.

[ Online version of the manpage can be found here:
http://www.FreeBSD.org/cgi/man.cgi?query=tr&apropos=0&sektion=1&manpath=FreeBSD+4.3-stable&format=html
(hope the URL gets through intact) ]

So, under the POSIX standard at least (and *BSD, in this case), the One
True Way is:

tr A-Za-z N-ZA-Mn-za-m

Does that work under Solaris?

> % Well, the lesson is that tr usage varies wildly among platforms,
> % just like expr, but we already knew that. :)

That's what POSIX tries to remedy. :)

> % So maybe it's best just to have your .mailcap call that rot13 shell
> % script, and adapt the script to cope with unames appropriately. Or
> % use perl.
> 
> sh is portable (see other drifted-off-topic thread :-) but with this
> much garbage rolled in I think I will, indeed, go for perl.

Heavens man, have you no concern for efficiency? :-) If the POSIX
version doesn't work under Solaris, i'd rather go for:

tr ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \
   NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm

Much more lightweight, and should work practically anywhere, even if
it involves a bit of extra typing.

Also, as for getting mutt to actually use the filter, i'm surprised no
one has pointed at $display_filter yet.

Instead of resorting to hacks involving .mailcap and (horrors :-) editing
the message's content type[1], you can just do something like:

macro pager (   "set display_filter=\nmacro pager \\ca 
)\n"
macro pager )   "set display_filter=rot13\nmacro pager 
\\ca (\n"
macro pager \ca )   "Toggle ROT13 decoding"

(Pity there's no way to force mutt to re-parse the message... i'm using
a double  to simulate one.)

Just replace `rot13' with your chosen filter command and you're set;  no
extra config required, and no risk of munging actual messages.


[1] What happens if the message you're rot'ing is something besides
text/plain, like text/html f'rinstance?  The given macro will just
nuke the content-type from orbit, leaving you looking at HTML
source.

-- 
Piet Delport <[EMAIL PROTECTED]>
Today's subliminal thought is:

 PGP signature


Re: rot13 capability?

2001-09-19 Thread Vineet Kumar

* David Champion ([EMAIL PROTECTED]) [010919 10:38]:
> On 2001.09.19, in <[EMAIL PROTECTED]>,
>   "Miguel Farah F." <[EMAIL PROTECTED]> wrote:
> > Jura ernqvat arjf jvgu gva, vs bar cerffrf gur 'q' xrl, gur pbagrag bs
> > gur negvpyr orvat ernq jvyy or ebg13-rq.
> > 
> > V guvax zhgg pbhyq unir guvf pncnovyvgl, gbb. Jung V qb pheeragyl vf
> > cvcr gur znvy V'z ernqvat gb gur ebg13 pbzznaq va zl ~/ova qverpgbel,
> > ohg vg'f abg nf pbairavrag nf orvat noyr gb qb vg gur gva jnl
> 
> How about this?
> 
> auto_view text/rot-13
> macro index \Ca 
>"text/rot-13text/plain"
> "Display message with ROT-13 encoding"

To use it with PGP (well, PGP/MIME, anyway) or other mime multipart
messages, try this version instead:

macro attach \Ca 
"text/x-rot13text/plain"
 "Display message with ROT-13 encoding"

Also, these don't work so well with the builtin pager, because the
display-message or view-attach commands return immediately in that case.
For the internal pager, you may be better off with something like these
2 macros together:

macro pager \Ca "text/x-rot13" "Display message with 
ROT-13 encoding"
macro pager \CA "text/plain" "Revert message from ROT-13 
back to text/plain"

Does anyone have a better idea of how to make one macro that toggles? Is
there a way to make a "named" macro? Then you could do something like
this:

function1() {
  push "text/x-rot13"
  macro pager \Ca function2
}

function2() {
  push "text/plain"
  macro pager \Ca function1
}

I guess you could effect it with "push":(untested)


 macro pager \Cb 'text/x-rot13macro \Ca "push \CB"'
 macro pager \CB 'text/plainmacro \Ca "push \Cb"'
 macro pager \Ca 'push \Cb'

but you 'lose' a couple of keys that way. I suppose you could make them
some inconvenient keybinding that you'd never use anyway, and then you'd
be all right.

all of these 'toggle' methods also break horribly if you rot13 a message
and then don't change it back before you go off and view other messages.
Well, maybe not horribly; you'll just have to hit \Ca a couple of times
until it straightens itself out.

-- 
Vineet   http://www.anti-dmca.org
Unauthorized use of this .sig may constitute violation of US law.
echo Qba\'g gernq ba zr\! |tr 'a-zA-Z' 'n-za-mN-ZA-M'

 PGP signature


Re: rot13 capability?

2001-09-19 Thread Vineet Kumar

* David Champion ([EMAIL PROTECTED]) [010919 10:38]:
> On 2001.09.19, in <[EMAIL PROTECTED]>,
>   "Miguel Farah F." <[EMAIL PROTECTED]> wrote:
> > Jura ernqvat arjf jvgu gva, vs bar cerffrf gur 'q' xrl, gur pbagrag bs
> > gur negvpyr orvat ernq jvyy or ebg13-rq.
> > 
> > V guvax zhgg pbhyq unir guvf pncnovyvgl, gbb. Jung V qb pheeragyl vf
> > cvcr gur znvy V'z ernqvat gb gur ebg13 pbzznaq va zl ~/ova qverpgbel,
> > ohg vg'f abg nf pbairavrag nf orvat noyr gb qb vg gur gva jnl
> 
> How about this?
> 
> auto_view text/rot-13
> macro index \Ca 
>"text/rot-13text/plain"
> "Display message with ROT-13 encoding"
> 
> $ grep rot-13 ~/.mailcap
> text/rot-13; tr '[A-Z][a-z]' '[N-Z][A-M][n-z][a-m]' <%s; copiousoutput
> 
> That's the only way to get a filter to display inside the pager: set the
> content-type so that a MIME content handler applies.
> 
> -- 
>  -D.  [EMAIL PROTECTED]NSITUniversity of Chicago
> 

You maniac! You'd better watch out what you do with that; if you use it
to decipher my signature I'll send the FBI after you for violating the
DMCA.

=p

-- 
Vineet   http://www.anti-dmca.org
Unauthorized use of this .sig may constitute violation of US law.
echo Qba\'g gernq ba zr\! |tr 'a-zA-Z' 'n-za-mN-ZA-M'

 PGP signature


Re: rot13 capability?

2001-09-19 Thread David T-G

David --

...and then David Champion said...
% On 2001.09.19, in <[EMAIL PROTECTED]>,
%   "David T-G" <[EMAIL PROTECTED]> wrote:
% > 
% > Actually, I don't think so; that's what's so interesting.  I'd love to
% > see the results of same experiment under 2.6 and 8;
% 
% Weird: I find that 7 behaves as 9 does -- '[A-Z][a-z]'
% '[N-Z][A-M][n-z][a-m]' works, but the others give "bad string" errors.

Interesting.


% On Solaris 8, this also works, but the other forms do not give "bad
% string". They just include the brackets in the ranges. (IOW, it seems

Strange -- like my SuSE GNU/Linux tr from textutils 2.0 does...


% that they require congruent ranges.) I don't have anything less than
% Solaris 7 anymore. Except... hmm. Yes, SunOS 4.1.4 wins this contest.
% It'll take any number of ranges on either side, the Way Things Ought To
% Be.

*smile*


% 
% Guess someone just can't make up their minds. I wonder whether it's Sun
% or a standards agency. I wish I still had other platforms

Yeah.


% 
% Well, the lesson is that tr usage varies wildly among platforms, just
% like expr, but we already knew that. :) So maybe it's best just to have
% your .mailcap call that rot13 shell script, and adapt the script to cope
% with unames appropriately. Or use perl.

sh is portable (see other drifted-off-topic thread :-) but with this
much garbage rolled in I think I will, indeed, go for perl.


% 
% -- 
%  -D.  [EMAIL PROTECTED]NSITUniversity of Chicago


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: rot13 capability?

2001-09-19 Thread David Champion

On 2001.09.19, in <[EMAIL PROTECTED]>,
"David T-G" <[EMAIL PROTECTED]> wrote:
> 
> Actually, I don't think so; that's what's so interesting.  I'd love to
> see the results of same experiment under 2.6 and 8;

Weird: I find that 7 behaves as 9 does -- '[A-Z][a-z]'
'[N-Z][A-M][n-z][a-m]' works, but the others give "bad string" errors.
On Solaris 8, this also works, but the other forms do not give "bad
string". They just include the brackets in the ranges. (IOW, it seems
that they require congruent ranges.) I don't have anything less than
Solaris 7 anymore. Except... hmm. Yes, SunOS 4.1.4 wins this contest.
It'll take any number of ranges on either side, the Way Things Ought To
Be.

Guess someone just can't make up their minds. I wonder whether it's Sun
or a standards agency. I wish I still had other platforms

Well, the lesson is that tr usage varies wildly among platforms, just
like expr, but we already knew that. :) So maybe it's best just to have
your .mailcap call that rot13 shell script, and adapt the script to cope
with unames appropriately. Or use perl.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: rot13 capability?

2001-09-19 Thread David Champion

On 2001.09.19, in <[EMAIL PROTECTED]>,
"David T-G" <[EMAIL PROTECTED]> wrote:
> % $ grep rot-13 ~/.mailcap
> % text/rot-13; tr '[A-Z][a-z]' '[N-Z][A-M][n-z][a-m]' <%s; copiousoutput
> 
> Hey, that's slick.  I just might have to try that one!
> 
> You need to lose the extra brackets, though, to make it
> 
>   text/rot-13; tr '[A-Z][a-z]' '[N-ZA-M][n-za-m]' <%s; copiousoutput

Actually, mine is what works on Solaris (well, on Solaris 9, anyway).
I tried your approach and one other (thinking that they were correct)
before I realized that GNU is Just Different once again. :)

The content-type should probably be text/x-rot-13, though. I don't know
that text/rot-13 has been registered.


> or even simply lose them entirely; your version breaks for me here under
> Linux (though I don't know about under Solaris, which would definitely
> support both of my versions).

Must be using GNU textutils. :)

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: rot13 capability?

2001-09-19 Thread David T-G

David --

...and then David Champion said...
% On 2001.09.19, in <[EMAIL PROTECTED]>,
%   "Miguel Farah F." <[EMAIL PROTECTED]> wrote:
% > Jura ernqvat arjf jvgu gva, vs bar cerffrf gur 'q' xrl, gur pbagrag bs
% > gur negvpyr orvat ernq jvyy or ebg13-rq.
...
% How about this?

*grin*


% 
% auto_view text/rot-13
% macro index \Ca 
"text/rot-13text/plain"
 "Display message with ROT-13 encoding"
% 
% $ grep rot-13 ~/.mailcap
% text/rot-13; tr '[A-Z][a-z]' '[N-Z][A-M][n-z][a-m]' <%s; copiousoutput

Hey, that's slick.  I just might have to try that one!

You need to lose the extra brackets, though, to make it

  text/rot-13; tr '[A-Z][a-z]' '[N-ZA-M][n-za-m]' <%s; copiousoutput

or even simply lose them entirely; your version breaks for me here under
Linux (though I don't know about under Solaris, which would definitely
support both of my versions).


% 
% That's the only way to get a filter to display inside the pager: set the
% content-type so that a MIME content handler applies.

Neat idea, and it makes a lot of sense.


% 
% -- 
%  -D.  [EMAIL PROTECTED]NSITUniversity of Chicago


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: rot13 capability?

2001-09-19 Thread David Champion

On 2001.09.19, in <[EMAIL PROTECTED]>,
"Miguel Farah F." <[EMAIL PROTECTED]> wrote:
> Jura ernqvat arjf jvgu gva, vs bar cerffrf gur 'q' xrl, gur pbagrag bs
> gur negvpyr orvat ernq jvyy or ebg13-rq.
> 
> V guvax zhgg pbhyq unir guvf pncnovyvgl, gbb. Jung V qb pheeragyl vf
> cvcr gur znvy V'z ernqvat gb gur ebg13 pbzznaq va zl ~/ova qverpgbel,
> ohg vg'f abg nf pbairavrag nf orvat noyr gb qb vg gur gva jnl

How about this?

auto_view text/rot-13
macro index \Ca 
"text/rot-13text/plain"
 "Display message with ROT-13 encoding"

$ grep rot-13 ~/.mailcap
text/rot-13; tr '[A-Z][a-z]' '[N-Z][A-M][n-z][a-m]' <%s; copiousoutput

That's the only way to get a filter to display inside the pager: set the
content-type so that a MIME content handler applies.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: rot13 capability?

2001-09-19 Thread David T-G

Miguel --

...and then Miguel Farah F. said...
%  David T-G [19/09/2001 11:28] dijo/said:
% >
% >...and then Miguel Farah F. said...
% >% 
% >% I think mutt could have this capability, too. What I do currently is
% >% pipe the mail I'm reading to the rot13 command in my ~/bin directory,
% >% but it's not as convenient as being able to do it the tin way
% >
% >So define a macro to do it :-)  Take advantage of letting a small tool do
% >its thing well and letting tools talk together through pipelines rather
% >than trying to make mutt do everything by itself.
% 
% Er... is there a way to define a macro that will alter (rot13, in this
% case) the displaying of the pager's content? Or you just mean a macro
% to automatically do the piping I do manually?

No, your macro would pipe the message through rot13 through a pager and
then continue on however you wish (redisplay as-is in the internal pager,
back to the index, whatevre).  At least, that's what *my* macro would do
if I had one.


% 
% -- 
% MIGUEL FARAH  //   [EMAIL PROTECTED]
% #include//   http://www.nn.cl/~miguel
% <*>
% "Trust me - I know what I'm doing."
% - Sledge Hammer


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


Re: rot13 capability?

2001-09-19 Thread Miguel Farah F.

 David T-G [19/09/2001 11:28] dijo/said:
>Miguel --
>
>...and then Miguel Farah F. said...
>% When reading news with tin, if one presses the 'd' key, the content of
>% the article being read will be rot13-ed.
>
>Right.
>
>
>% 
>% I think mutt could have this capability, too. What I do currently is
>% pipe the mail I'm reading to the rot13 command in my ~/bin directory,
>% but it's not as convenient as being able to do it the tin way
>
>So define a macro to do it :-)  Take advantage of letting a small tool do
>its thing well and letting tools talk together through pipelines rather
>than trying to make mutt do everything by itself.

Er... is there a way to define a macro that will alter (rot13, in this
case) the displaying of the pager's content? Or you just mean a macro
to automatically do the piping I do manually?

-- 
MIGUEL FARAH  //   [EMAIL PROTECTED]
#include//   http://www.nn.cl/~miguel
<*>
"Trust me - I know what I'm doing."
- Sledge Hammer



Re: rot13 capability?

2001-09-19 Thread David T-G

Miguel --

...and then Miguel Farah F. said...
% When reading news with tin, if one presses the 'd' key, the content of
% the article being read will be rot13-ed.

Right.


% 
% I think mutt could have this capability, too. What I do currently is
% pipe the mail I'm reading to the rot13 command in my ~/bin directory,
% but it's not as convenient as being able to do it the tin way

So define a macro to do it :-)  Take advantage of letting a small tool do
its thing well and letting tools talk together through pipelines rather
than trying to make mutt do everything by itself.


% 
% -- 
% MIGUEL FARAH  //   [EMAIL PROTECTED]
% #include//   http://www.nn.cl/~miguel
% <*>
% "Trust me - I know what I'm doing."
% - Sledge Hammer


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


 PGP signature


rot13 capability?

2001-09-19 Thread Miguel Farah F.

When reading news with tin, if one presses the 'd' key, the content of
the article being read will be rot13-ed.

I think mutt could have this capability, too. What I do currently is
pipe the mail I'm reading to the rot13 command in my ~/bin directory,
but it's not as convenient as being able to do it the tin way

-- 
MIGUEL FARAH  //   [EMAIL PROTECTED]
#include//   http://www.nn.cl/~miguel
<*>
"Trust me - I know what I'm doing."
- Sledge Hammer