Re: functions/procedures in muttrc

2009-09-20 Thread Michael Tatge
* On Sun, Sep 20, 2009 05:42PM +0200 I (michael.ta...@web.de) muttered:
> * On Sun, Sep 20, 2009 01:39PM + Tamas K Papp (tkp...@gmail.com) muttered:
> > I find that I am doing some repetitive stuff in my .muttrc that occurs in 
> > multiple places (eg called by a folder hook, and also when mutt starts 
> > up).  I wonder if it would be possible to do something like
> > 
> > ## pseudocode
> > procedure gmail-folders {
> >   set from="tkp...@gmail.com"
> >   set record="+GMAIL/[Gmail].Sent Mail"
> >   set postponed="+GMAIL/[Gmail].Drafts"
> > }
> > 
> > folder-hook +GMAIL.* 'exec gmail-folders'
> >
> folder-hook +GMAIL.* 'set postponed="+GMAIL/[Gmail].Drafts"'
> 
> I don't see how that's different to
> 
> folder-hook +GMAIL.* 'set from=...;\
>set record=...;\
>set postponed=...'

or the already meantioned

folder-hook +GMAIL.* 'source gmail.settings'

HTH,

Michael
-- 
Make it idiot-proof, and someone will breed a better idiot.
-- Oliver Elphick

PGP-Key-ID: 0xDC1A44DD
Jabber: init...@amessage.de


Re: functions/procedures in muttrc

2009-09-20 Thread Tamas K Papp
On Sun, 20 Sep 2009 17:42:06 +0200, Michael Tatge wrote:

> * On Sun, Sep 20, 2009 01:39PM + Tamas K Papp (tkp...@gmail.com)
> muttered:
>> I find that I am doing some repetitive stuff in my .muttrc that occurs
>> in multiple places (eg called by a folder hook, and also when mutt
>> starts up).  I wonder if it would be possible to do something like
>> 
>> ## pseudocode
>> procedure gmail-folders {
>>   set from="tkp...@gmail.com"
>>   set record="+GMAIL/[Gmail].Sent Mail" set
>>   postponed="+GMAIL/[Gmail].Drafts"
>> }
>> 
>> folder-hook +GMAIL.* 'exec gmail-folders'
>> 
>> in place of
>> 
>> folder-hook +GMAIL.* 'set from="tkp...@gmail.com"' folder-hook +GMAIL.*
>> 'set record="+GMAIL/[Gmail].Sent Mail"' folder-hook +GMAIL.* 'set
>> postponed="+GMAIL/[Gmail].Drafts"'
> 
> I don't see how that's different to
> 
> folder-hook +GMAIL.* 'set from=...;\
>set record=...;\
>set postponed=...'

Sorry, maybe I was not clear in formulating the question.  Suppose
that I need to do the same set from=...;\ etc multiple times (eg once
at the beginning of my mutt file, so it is set correctly even before
any folder hooks are invoked; then in a folder-hook, etc).  Of course
I can just simply repeat stuff using copy-paste, but having it in one
place is nicer and easier to maintain.

Thanks,

Tamas



Re: functions/procedures in muttrc

2009-09-20 Thread Michael Tatge
* On Sun, Sep 20, 2009 01:39PM + Tamas K Papp (tkp...@gmail.com) muttered:
> I find that I am doing some repetitive stuff in my .muttrc that occurs in 
> multiple places (eg called by a folder hook, and also when mutt starts 
> up).  I wonder if it would be possible to do something like
> 
> ## pseudocode
> procedure gmail-folders {
>   set from="tkp...@gmail.com"
>   set record="+GMAIL/[Gmail].Sent Mail"
>   set postponed="+GMAIL/[Gmail].Drafts"
> }
> 
> folder-hook +GMAIL.* 'exec gmail-folders'
> 
> in place of
> 
> folder-hook +GMAIL.* 'set from="tkp...@gmail.com"'
> folder-hook +GMAIL.* 'set record="+GMAIL/[Gmail].Sent Mail"'
> folder-hook +GMAIL.* 'set postponed="+GMAIL/[Gmail].Drafts"'

I don't see how that's different to

folder-hook +GMAIL.* 'set from=...;\
   set record=...;\
   set postponed=...'

HTH,

Michael
-- 
#if _FP_W_TYPE_SIZE < 32
#error "Here's a nickel kid.  Go buy yourself a real computer."
#endif
-- linux/arch/sparc64/double.h

PGP-Key-ID: 0xDC1A44DD
Jabber: init...@amessage.de


Re: functions/procedures in muttrc

2009-09-20 Thread Tamas K Papp
On Sun, 20 Sep 2009 22:34:19 +0800, bill lam wrote:

> On Sun, 20 Sep 2009, Tamas K Papp wrote:
>> I read the manual but could not find anything similar.
> 
> info in mutt manual is hard to find unless you have already known that
> command. ;-)
> 
> look for the 'source' command, eg
> 
> source ~/mymuttfile

I know about source, but I don't really see how this solves my
problem.  Unless I put the commands in a file, and source it
every time I want to execute that procedure.  This looks a bit ugly
though.  Reminds me of Matlab :-)  Is this the only way?

Tamas



Re: functions/procedures in muttrc

2009-09-20 Thread bill lam
On Sun, 20 Sep 2009, Tamas K Papp wrote:
> I read the manual but could not find anything similar.

info in mutt manual is hard to find unless you have already known that
command. ;-)

look for the 'source' command, eg

source ~/mymuttfile

-- 
regards,

GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3


functions/procedures in muttrc

2009-09-20 Thread Tamas K Papp
Hi,

I find that I am doing some repetitive stuff in my .muttrc that occurs in 
multiple places (eg called by a folder hook, and also when mutt starts 
up).  I wonder if it would be possible to do something like

## pseudocode
procedure gmail-folders {
  set from="tkp...@gmail.com"
  set record="+GMAIL/[Gmail].Sent Mail"
  set postponed="+GMAIL/[Gmail].Drafts"
}

folder-hook +GMAIL.* 'exec gmail-folders'

in place of

folder-hook +GMAIL.* 'set from="tkp...@gmail.com"'
folder-hook +GMAIL.* 'set record="+GMAIL/[Gmail].Sent Mail"'
folder-hook +GMAIL.* 'set postponed="+GMAIL/[Gmail].Drafts"'

I read the manual but could not find anything similar.

Thanks,

Tamas