Re: folder-hook pattern param

2015-07-21 Thread Ian Zimmerman
On 2015-07-21 10:15 +0200, Michael Tatge wrote:

 folder-hooks use substring matches.

Unanchored regexp matches, to be more precise.

 ^ is a shortcut for the current mailbox. It's not BOL here.

Do you see how these 2 facts together make it hard to construct a
meaningful pattern, if you're worried about matches at different places
in the filesystem?  It's not your fault of course, unless you're a mutt
dev :-)

What I ended up doing (after spending several days patching the source
with debug prints just to understand WTH was happening) was:

folder-hook .*^/home/itz/foo/.* my_hdr X-itz-real-home-foo: yes

taking advantage of the fact that mutt's special handling of ^ (and
other folder shortcuts) only applies in the 0th position, after that
it retains its regexp BOL meaning.

Oh and BTW, in this case:

folder-hook ^foo my_hdr X-itz-real-home-foo: yes

^ is _not_ replaced with /home/itz/foo, /home/itz/inbox, or anything
like that, but with the empty string.  That is because the statement is
parsed at startup time, before any current folder is established.

I feel this thicket of gotchas really deserves a few paragraphs in the
manual.

Thanks for replying!

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



save email without header but as text?

2015-07-21 Thread Peter P.
Hi list,

(Mutt is a amazing client!)

I am wondering how I can save emails to disk as text files the way they
are displayed to me in the pager, ie. without the full header.
If I select the message body from the attachment menu, it is saved as
body only (evidently) without any From: addresses etc. If I save it from
the pager itself, using pipe, that is
 | cat  somefile.txt
It saves the full header, which is a bit too much info for my taste. I
don't want to print mails to a pdf file via muttprint, as textfiles are
easier to parse and edit.

Most looking forward to suggestions!
Peter


Re: save email without header but as text?

2015-07-21 Thread Ian Zimmerman
On 2015-07-21 12:43 -0400, Peter P. wrote:

 I am wondering how I can save emails to disk as text files the way they
 are displayed to me in the pager, ie. without the full header.
 If I select the message body from the attachment menu, it is saved as
 body only (evidently) without any From: addresses etc. If I save it from
 the pager itself, using pipe, that is

  | cat  somefile.txt

 It saves the full header, which is a bit too much info for my taste. I
 don't want to print mails to a pdf file via muttprint, as textfiles are
 easier to parse and edit.

So for multipart MIME messages, do you want to save the nontext parts or
not?

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



Re: not display hostname in References: ?

2015-07-21 Thread Ian Zimmerman
On 2015-07-21 12:50 -0400, Peter P. wrote:

 I am sending mails using msmtp (msmtp-queue, to be exact). In the
 References: field of emails that I send back to mailing list using
 list-reply, I notice that the hostname of my local box is inserted, and
 would prefer to keep it out of there. I am not sure if this a mutt or an
 msmtp issue, please excuse me if this is inappropriate here. 
 Does anyone know of a way to suppress the own boxes hostname from that
 field in replies sent to lists?

The References header field is not free form: its meaning and syntax is
specified by RFC 2822.  Bascially, mutt has no choice in the matter, if
it wants to stay standard conforming.

You probably have asked the wrong question, and what you really want is
to change the Message-ID header of you outgoing emails.  You can do that
with the regular mutt my_hdr mechanism, although the manual warns
against it, and it is a bit tricky as I discovered myself.  Here's 2
lines from my muttrc:

send-hook . my_hdr Message-ID: \`mutt-message-id\`
send2-hook . my_hdr Message-ID: \`mutt-message-id\`

Here mutt-message-id is a script that generates the ID in a format I
like.  (But be very sure that the ID you generate is unique and conforms
to the standard.  You really need to read RFC 2822 if you do this.)

_Both_ lines are necessary to override the mutt-generated ID in all cases.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



Re: not display hostname in References: ?

2015-07-21 Thread Peter P.
* Ian Zimmerman i...@buug.org [2015-07-21 13:49]:
 On 2015-07-21 12:50 -0400, Peter P. wrote:
 
  I am sending mails using msmtp (msmtp-queue, to be exact). In the
  References: field of emails that I send back to mailing list using
  list-reply, I notice that the hostname of my local box is inserted, and
  would prefer to keep it out of there. I am not sure if this a mutt or an
  msmtp issue, please excuse me if this is inappropriate here. 
  Does anyone know of a way to suppress the own boxes hostname from that
  field in replies sent to lists?
 
 The References header field is not free form: its meaning and syntax is
 specified by RFC 2822.  Bascially, mutt has no choice in the matter, if
 it wants to stay standard conforming.
 
 You probably have asked the wrong question, and what you really want is
 to change the Message-ID header of you outgoing emails.  
Thank you Ian! The manpage for muttrc mentions that setting
$hostname
affects the Message-ID, and I just verified that it does.

Am I then right to assume that References: header fileds are derived
from Message-IDs, and that by setting $hostname should hence be the
solution to my problem? I will try to find out.

 You can do that
 with the regular mutt my_hdr mechanism, although the manual warns
 against it, and it is a bit tricky as I discovered myself.  Here's 2
 lines from my muttrc:
 
 send-hook . my_hdr Message-ID: \`mutt-message-id\`
 send2-hook . my_hdr Message-ID: \`mutt-message-id\`
 
 Here mutt-message-id is a script that generates the ID in a format I
 like.  (But be very sure that the ID you generate is unique and conforms
 to the standard.  You really need to read RFC 2822 if you do this.)
 
 _Both_ lines are necessary to override the mutt-generated ID in all cases.
Thank you for pointing out your way of doing it! This is much
appreciated!

best, Peter


not display hostname in References: ?

2015-07-21 Thread Peter P.
Hi Muttlist,

I am sending mails using msmtp (msmtp-queue, to be exact). In the
References: field of emails that I send back to mailing list using
list-reply, I notice that the hostname of my local box is inserted, and
would prefer to keep it out of there. I am not sure if this a mutt or an
msmtp issue, please excuse me if this is inappropriate here. 
Does anyone know of a way to suppress the own boxes hostname from that
field in replies sent to lists?

Thank you!
P


Re: save email without header but as text?

2015-07-21 Thread Suvayu Ali
On Tue, Jul 21, 2015 at 12:43:34PM -0400, Peter P. wrote:
 the pager itself, using pipe, that is
  | cat  somefile.txt
 It saves the full header, which is a bit too much info for my taste. I
 don't want to print mails to a pdf file via muttprint, as textfiles are
 easier to parse and edit.

Maybe set $pipe_decode=yes?

-- 
Suvayu

Open source is the future. It sets us free.


Re: save email without header but as text?

2015-07-21 Thread Peter P.
* Ian Zimmerman i...@buug.org [2015-07-21 13:12]:
 On 2015-07-21 12:43 -0400, Peter P. wrote:
 
  I am wondering how I can save emails to disk as text files the way they
  are displayed to me in the pager, ie. without the full header.
  If I select the message body from the attachment menu, it is saved as
  body only (evidently) without any From: addresses etc. If I save it from
  the pager itself, using pipe, that is
 
   | cat  somefile.txt
 
  It saves the full header, which is a bit too much info for my taste. I
  don't want to print mails to a pdf file via muttprint, as textfiles are
  easier to parse and edit.
 
 So for multipart MIME messages, do you want to save the nontext parts or
 not?
Hm, didn't thought of that distinction yet. I would say for now, yes,
with nontext parts, as I could always chose to save withouth them from
the attachment menu.


Re: save email without header but as text?

2015-07-21 Thread Peter P.
* Suvayu Ali fatkasuvayu+li...@gmail.com [2015-07-21 13:16]:
 On Tue, Jul 21, 2015 at 12:43:34PM -0400, Peter P. wrote:
  the pager itself, using pipe, that is
   | cat  somefile.txt
  It saves the full header, which is a bit too much info for my taste. I
  don't want to print mails to a pdf file via muttprint, as textfiles are
  easier to parse and edit.
 
 Maybe set $pipe_decode=yes?
Thank you so much Suvayi, this is it! Yes! ;)
Again... Thanks!
P


Re: Use of vcalendar with mutt

2015-07-21 Thread Brian Salter-Duke
On Mon, Jul 20, 2015 at 11:44:03PM +0200, Bernard Massot wrote:
 Le 20/07/2015 à 13:31, Brian Salter-Duke a écrit :
  I used vcalender long ago, but then had no use for it, but I am now getting 
  a
  lot of important emails from the university where I have an adjunct
  appointment. I work at home and I do not have the Windows nonsense that full
  time members of the department have to use.
 I'm not sure if this is what you meant, but iCalendar format is not
 Windows nonsense. It's a plain text format standardized in a RFC.
 
  In my mailcap I have:-
  
  text/calendar; /home/brian/.mutt/vcalendar-filter; copiousoutput
  application/ics; /home/brian/.mutt/vcalendar-filter; copiousoutput
 You have to use auto_view text/calendar application/ics in your
 .muttrc as well.
 Otherwise Mutt shows it as plain text, i.e. in its raw format.

Thanks for the suggestion.

I have that in my muttrc, but in the case where the only part of
the email shows as:-
 
1 [ 8.6K] no descriptionquoted-printable text/calendar

it gives:-

[-- Autoview using cat --]

at the top of the plain text output. I am puzzled.

Brian.

 -- 
 Bernard Massot

-- 
Using encryption on the Internet is the equivalent of arranging an
armored car to deliver credit-card information from someone living in a
cardboard box to someone living on a park bench.
-- Gene Spafford
Brian Salter-Duke (Brian Duke) Email: b_duke(AT)bigpond(DOT)net(DOT)au


Re: not display hostname in References: ?

2015-07-21 Thread Ian Zimmerman
On 2015-07-21 14:02 -0400, Peter P. wrote:

 Am I then right to assume that References: header fileds are derived
 from Message-IDs, and that by setting $hostname should hence be the
 solution to my problem?

It will solve your problem (such as it is) for new threads from now on.

In existing threads, existing message-ids embedded in References will
stay as they are (even in new messages in those threads).  Message-Ids
are immutable, that is part of their value.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



Re: not display hostname in References: ?

2015-07-21 Thread Peter P.
* Ian Zimmerman i...@buug.org [2015-07-21 14:58]:
 On 2015-07-21 14:02 -0400, Peter P. wrote:
 
  Am I then right to assume that References: header fileds are derived
  from Message-IDs, and that by setting $hostname should hence be the
  solution to my problem?
 
 It will solve your problem (such as it is) for new threads from now on.
 
 In existing threads, existing message-ids embedded in References will
 stay as they are (even in new messages in those threads).  Message-Ids
 are immutable, that is part of their value.
Perfectly fine, thank you again for your help Ian!
P


Re: folder-hook pattern param

2015-07-21 Thread Michael Tatge
I should read more carefully.

* On Tue, Jul 21, 2015 10:15AM +0200 I (tatg...@gmail.com) muttered:
 * On Wed, Jul 15, 2015 01:00PM -0700 Ian Zimmerman (i...@buug.org) muttered:
  Which of the following will fire when entering /home/itz/foobar/inbox ?
   ^^
  folder-hook Mail/inbox my_hdr X-Foo: Bar
 
 /home/itz/Mail/inbox
   ^^- match
  no match we're opening /home/itz/foobar/inbox
 
  folder-hook ~/Mail/inbox my_hdr X-Foo: Bar
 
 /home/itz/Mail/inbox
 - match
  no match we're opening /home/itz/foobar/inbox
 
  folder-hook foobar/inbox my_hdr X-Foo: Bar
 
 /home/itz/foobar/inbox
     - depends how you open the folder

match, substring
  
  folder-hook ~/foobar/inbox my_hdr X-Foo: Bar
 
 /home/itz/foobar/inbox
 ^^  - depends how you open the folder

match
 
  folder-hook /home/itz/Mail/inbox my_hdr X-Foo: Bar
 
 /home/itz/Mail/inbox- =inbox, match

no match /home/itz/Mail/inbox != /home/itz/foobar/inbox

  folder-hook /home/itz/foobar/inbox my_hdr X-Foo: Bar
 
 /home/itz/foobar/inbox
 ^^  - depends how you open the folder

match and identical to ~/foobar/inbox

Michael
-- 
PGP-Key-ID: EEE7D043
Jabber: in...@jabber.de


Re: folder-hook pattern param

2015-07-21 Thread Michael Tatge
Ian,

* On Wed, Jul 15, 2015 01:00PM -0700 Ian Zimmerman (i...@buug.org) muttered:
 It is not clear from the manual against what the folder-hook command
 matches the given pattern.

folder-hooks use substring matches.

 Let's say my folders are under /home/itz/foobar/ , and /home/itz/Mail is
 a symbolic link to foobar.  Let us further assume the following is set
 globally:
 
 set folder=~/Mail
 
 Which of the following will fire when entering /home/itz/foobar/inbox ?

Well, why didn't you just test it?
So /home/itz/Mail - /home/itz/foobar
and $folder=~/Mail - /home/itz/Mail

 folder-hook ^inbox my_hdr X-Foo: Bar

^ is a shortcut for the current mailbox. It's not BOL here.
Assume ~/Mail/foo is the current mailbox. Then ^inbox is
/home/itz/Mail/foo/inbox - no match

 folder-hook ^=inbox my_hdr X-Foo: Bar

= is a shortcut for $folder
/home/itz/Mail/foo/home/itz/Mail/inbox - no match

 folder-hook Mail/inbox my_hdr X-Foo: Bar

/home/itz/Mail/inbox
  ^^- match

 folder-hook ~/Mail/inbox my_hdr X-Foo: Bar

/home/itz/Mail/inbox
- match

 folder-hook foobar/inbox my_hdr X-Foo: Bar

/home/itz/foobar/inbox
    - depends how you open the folder
If you open via ~/Mail it won't match.

 folder-hook ~/foobar/inbox my_hdr X-Foo: Bar

/home/itz/foobar/inbox
^^  - depends how you open the folder

 folder-hook /home/itz/Mail/inbox my_hdr X-Foo: Bar

/home/itz/Mail/inbox- =inbox, match

 folder-hook /home/itz/foobar/inbox my_hdr X-Foo: Bar

/home/itz/foobar/inbox
^^  - depends how you open the folder

Your best match is spelling out the complete path, to avoid substring
matches with other folders.
folder-hook inbox will match anything with the string inbox.
~/Mail/inbox
/inbox
~/Mail/myinbox
etc.

Let's ignore the symlink for now.
You want to match /home/itz/Mail/inbox and that is =inbox in short.

folder-hook . unmy_hdr X-Foo
folder-hook =inbox my_hdr X-Foo: Bar

 Now assume in addition that inbox is in fact a maildir.
 
 folder-hook ^inbox/ my_hdr X-Foo: Bar

See the note about ^ above. You don't need a trailing / with maildir

HTH,

Michael
-- 
PGP-Key-ID: EEE7D043
Jabber: in...@jabber.de


Re: folder-hook pattern param

2015-07-21 Thread Erik Christiansen
On 15.07.15 13:00, Ian Zimmerman wrote:
 Let us further assume the following is set globally:
 
 set folder=~/Mail
 
 (I can neither confirm nor deny that this is in fact the case :)

Try:

:set ? folder

Here, that gives:

folder=~/mail

due to:

$ grep folder .muttrc
set folder=~/mail

Erik