Re: get mail in directory browser

2009-04-22 Thread Zhengquan Zhang
On Tue, Apr 21, 2009 at 11:14:10PM -0500, Kyle Wheeler wrote:
 The key bit of information that you're missing is that default 
 keybindings also override generic keybindings. Think about it like an 
 overlay: you have a set of keybindings for generic and you have a 
 set of bindings for index (including the default index-specific 
 bindings). When you're in an index and you press a key, first it 
 checks the index layer (including all the default index bindings), 
 and then if none is found, it checks the generic layer.
 
 By default, the G key in the index layer triggers the internal mail 
 fetcher.

Thank you Kyle. This is really nice explanation. Now I understand it!

Regards,

-- 
Zhengquan



Re: get mail in directory browser

2009-04-21 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 10:39:17PM -0500, Kyle Wheeler wrote:
 On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
 macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail

 macro generic G ...etc...

Because I accidentally destroyed my muttrc etc in synchronization with
another computer, I am revisiting this post to rebuild my muttrc.

I tried version 1

macro generic G shell-escape/usr/bin/getmail -venter \

Invoke Getmail   

in index mode it would say
POP host is not defined. I use getmail to fetch mail so I don't set
pop host in muttrc. But once I set all parameters for pop in muttrc. 'G'
would launch mutt's internal fetch-mail function instead what I have set
in the macro.

in pager mode it does not either, it would say
Key is not bound.  Press '?' for help.
I understand this because generic does not include pager mode.

in browser mode it works.

I tried version 2

macro index,pager,browser G shell-escape/usr/bin/getmail -v enter \   
   
   Invoke getmail 
   


this works well in 3 modes.

My question would be why version 2 works in 3 modes but version 1 does
not work in index mode?

Thank you very much!

Regards,

-- 
Zhengquan



Re: get mail in directory browser

2009-04-21 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tuesday, April 21 at 10:50 PM, quoth Zhengquan Zhang:
 On Mon, Apr 06, 2009 at 10:39:17PM -0500, Kyle Wheeler wrote:
 On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
 macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail

 macro generic G ...etc...

 I tried version 1

 macro generic G shell-escape/usr/bin/getmail -venter \ 
Invoke Getmail

 in index mode it would say 
 POP host is not defined.

*generic* mode is like setting up the default. If there's another 
binding specific to index mode or pager mode or whatever mode, that 
other binding will override the generic mode settings.

 My question would be why version 2 works in 3 modes but version 1 
 does not work in index mode?

The key bit of information that you're missing is that default 
keybindings also override generic keybindings. Think about it like an 
overlay: you have a set of keybindings for generic and you have a 
set of bindings for index (including the default index-specific 
bindings). When you're in an index and you press a key, first it 
checks the index layer (including all the default index bindings), 
and then if none is found, it checks the generic layer.

By default, the G key in the index layer triggers the internal mail 
fetcher.

Unfortunately, there's no real unbind function, so you can't force 
the index layer to pass G on to the generic layer.

At least, that's the way that I understand it; I may be wrong.

~Kyle
- -- 
When the people fear the government, there is tyranny; when the 
government fears the people, there is liberty.
-- Thomas Jefferson
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknumZIACgkQBkIOoMqOI149YwCg59lu5wqALXr3L1SRg9iXfsSr
gD8AnjK3Fr8QwwYRIKJ7rXNeBs9A77Da
=LGYJ
-END PGP SIGNATURE-


get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
Dear mutt community,
I use 

macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail

to get mail from pop servers.

But as you see the macro works only in index and pager environment.
I also want to be able to get mail when I was in directory browser, that
is when I was changing mailboxes.

Could you please tell me how to modify the macro definition to make it
working?

Thanks,


-- 
Zhengquan


Re: get mail in directory browser

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail

to get mail from pop servers.

While simple-looking, it's generally a better idea to call the 
functions you want to use directly from your macro, rather than use 
keybindings that may later change. For example, if you ever decide to 
rebind the ! key, or bind the !  combination, this macro would stop 
working unexpectedly.

Here's a better way of writing the same macro:

macro index,pager G shell-escape/usr/bin/getmail -venter \
 Invoke Getmail

But as you see the macro works only in index and pager environment.
I also want to be able to get mail when I was in directory browser, that
is when I was changing mailboxes.

Easy - just add another comma:

macro index,pager,browser G ...etc...

OR you could try:

macro generic G ...etc...

But that latter would be overridden by any 
index/pager/browser-specific G keybindings.

~Kyle
- -- 
The average Ph.D thesis is nothing but the transference of bones from 
one graveyard to another.
-- J. Frank Dobie, A Texan in England
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknayuUACgkQBkIOoMqOI16lowCbBu4J7u/BR/UtzDaCiInaBeUA
S0MAoMjF4fgKLMn7phMhlKuTFNe/9oLv
=J24c
-END PGP SIGNATURE-


Re: get mail in directory browser

2009-04-06 Thread Nicolas Sebrecht
On Mon, Apr 06, 2009 at 09:56:08PM -0500, Zhengquan Zhang wrote:

 macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail

macro generic,pager G ! /usr/bin/getmail -v \n Invoke getmail

-- 
Nicolas Sebrecht


Re: get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 10:39:17PM -0500, Kyle Wheeler wrote:
 On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
 macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail
 
 to get mail from pop servers.
 
 While simple-looking, it's generally a better idea to call the 
 functions you want to use directly from your macro, rather than use 
 keybindings that may later change. For example, if you ever decide to 
 rebind the ! key, or bind the !  combination, this macro would stop 
 working unexpectedly.
 
 Here's a better way of writing the same macro:
 
 macro index,pager G shell-escape/usr/bin/getmail -venter \
  Invoke Getmail
 
 But as you see the macro works only in index and pager environment.
 I also want to be able to get mail when I was in directory browser, that
 is when I was changing mailboxes.
 
 Easy - just add another comma:
 
 macro index,pager,browser G ...etc...
 
 OR you could try:
 
 macro generic G ...etc...
 
 But that latter would be overridden by any 
 index/pager/browser-specific G keybindings.
 
Thanks Kyle, I appreciate it so much.
Zhengquan

 
 ~Kyle
 -- 
 The average Ph.D thesis is nothing but the transference of bones from 
 one graveyard to another.
 -- J. Frank Dobie, A Texan in England

-- 
Zhengquan


[solved] Re: get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
On Tue, Apr 07, 2009 at 05:55:52AM +0200, Nicolas Sebrecht wrote:
 On Mon, Apr 06, 2009 at 09:56:08PM -0500, Zhengquan Zhang wrote:
 
  macro index,pager G ! /usr/bin/getmail -v \n Invoke getmail
 
 macro generic,pager G ! /usr/bin/getmail -v \n Invoke getmail
Thanks, Nicolas,
 
 -- 
 Nicolas Sebrecht

-- 
Zhengquan