Re: custom macro for "q" key
> On 2021-09-02 11:58, Bastian wrote: Lets assume that after leaving the browser there is a quit command you could solve it with: macro browser q "" "QUIT MUTT FROM BROWSER" That works exactly as I wanted. You are a genius. thank you
Re: custom macro for "q" key
Lets assume that after leaving the browser there is a quit command you could solve it with: macro browser q "" "QUIT MUTT FROM BROWSER" This won't work in browsers behind composing a mail (attachment browser e.g.). Another idea, I think you can always push Ctrl+C to leave mutt at any location. -- Bastian
Re: custom macro for "q" key
yes, the is called "browser" in my case also. But when I bind: bind browser q exit and use "q" in browser, it does not exit, but just cycles between browser and the folder where I came from. Ok, so I just checked the help and apparently the 'exit' function's description is 'exit this menu'. So it seems the exit function was never meant to fully exit mutt but just exit the menu it is currently in. And also, you suggested previously to use "exit", but this keyword does not seem to exist in my mutt (2.0.2). When I use this binding: bind browser q quit .mutt/muttrc, line 80: quit: no such function in map Yeah, looking at the help again, it seems the function 'quit' exists in index and pager (although in pager it also doesn't exit mutt fully), but it doesn't seem to exist in 'browser'. Hence why you get an error when using bind browser q quit that quit doesn't exist. I hope that I am wrong, but to me it seems like there is currently no way to achieve what you want. Best Regards, IFo Hancroft
Re: custom macro for "q" key
> On 2021-09-02 06:54, Jon LaBadie wrote: On Wed, Sep 01, 2021 at 08:04:29AM +0200, Fourhundred Thecat wrote: On 2021-08-30 14:28, li...@ifohancroft.com wrote: macro index,pager c "?" macro index q "?" bind browser q exit You are defining macros in the index and pager. Why the switch to bind instead of a macro for the browser? when I use macro, instead of bind, then "quit" does exist. macro browser q quit but when I press "q" in browser, I get: Macro loop detected. Here is the whole relevant block from muttrc: bind index,pagerc browse-mailboxes bindindex q browse-mailboxes bindpager q exit macro browser q quit
Re: custom macro for "q" key
On Wed, Sep 01, 2021 at 08:04:29AM +0200, Fourhundred Thecat wrote: On 2021-08-30 14:28, li...@ifohancroft.com wrote: ... macro index,pager c "?" macro indexq "?" bind browser q exit But it does not behave as I expected: Likely showing my mutt-ignorance here, but ... You are defining macros in the index and pager. Why the switch to bind instead of a macro for the browser? -- Jon H. LaBadie j...@labadie.us 11226 South Shore Rd. (703) 787-0688 (H) Reston, VA 20190 (703) 935-6720 (C)
Re: custom macro for "q" key
> On 2021-09-02 04:47, Fourhundred Thecat wrote: > On 2021-09-01 20:54, li...@ifohancroft.com wrote: And also, you suggested previously to use "exit", but this keyword does not seem to exist in my mutt (2.0.2). When I use this binding: bind browser q quit sorry, I meant to say: you suggested previously to use "quit", but this keyword does not seem to exist in my mutt
Re: custom macro for "q" key
> On 2021-09-01 20:54, li...@ifohancroft.com wrote: I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bind q exit thank you, Unless I am wrong and there is more than one list of folders, its bind type is 'browser'. One way to check/confirm that is by pressing '?' while there and checking what the status line says. It should say something like: Help for . (35%) yes, the is called "browser" in my case also. But when I bind: bind browser q exit and use "q" in browser, it does not exit, but just cycles between browser and the folder where I came from. And also, you suggested previously to use "exit", but this keyword does not seem to exist in my mutt (2.0.2). When I use this binding: bind browser q quit .mutt/muttrc, line 80: quit: no such function in map So basically, now I just need to find pout, how to actually exit when I press "q" in browser. thank you,
Re: custom macro for "q" key
I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bindq exit thank you, Unless I am wrong and there is more than one list of folders, its bind type is 'browser'. One way to check/confirm that is by pressing '?' while there and checking what the status line says. It should say something like: Help for . (35%) That is what you should use when binding. Chances are, its type is also index or pager as opposed to having a separate one. In which case your macro won't be possible.
Re: custom macro for "q" key
> On 2021-08-30 14:28, li...@ifohancroft.com wrote: Hi, You basically have to unbind q for index (perhaps also pager, depending on what you want) and create the same macro you already have for 'c', for 'q' as well. Then for 'browser' bind 'q' to to 'quit' again. So basically: bind index,pager c noop # Unbinding the key first, because the manual says that macros shouldn't be bound to keys that are already bound bind index,pager q noop # Same as above macro index,pager c "?" macro index,pager q "?" bind browser q quit Hi, I have used your suggestions, with some modifications (I had to use exit, instead of quit), but it does not behave as I expected: macro index,pager c "?" macro indexq "?" bind browser q exit But it does not behave as I expected: - When I start mutt, I land in index. When press "q", then I go to the list of folders (good: this is what I want). But, now (I am in list of folders), pressing "q" should exit mutt. Instead, it goes back to index. - When I am in pager, and press "q", then I go back to the underlying folder (good: this is what I want). When I press "q" one more time, then I go to the list of my folders (also what I want). But then if I pres "q" again, I go back to the folder where I cam from, instead of exiting mutt. I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bindq exit thank you,
Re: custom macro for "q" key
On Mon, Aug 30, 2021 at 07:39:00PM -0700, li...@ifohancroft.com wrote: Would you mind pointing out where you got that information? As far as I know there is no need to do this, but maybe there is a problem I'm not aware of. Sorry. I meant to reply to the list. Posting my reply to his back to the list too. I'd be happy to. Apparently, I was wrong and it was not in the manual, but in the Mutt Guide: https://gitlab.com/muttmua/mutt/-/wikis/MuttGuide/Macros#how-to-use Under 'Usage: macro menu key sequence [ description ]', right before the first example, in the explanation of each part, there is the sentence: "Though you can use the bound keys too, that is not recommended!" I see. Thanks for replying and letting me know. In this case, I believe they are saying to use the syntax inside the macro, rather than the keys bound to the function. For example, using "" rather than ":", or "" rather than "!". That way, your macros are portable and don't break if you decide to map a different key to "" or "" in the future. I thought there may be something about it, that may create a problem in a weird edge case, that if I encounter some day might confuse the hell out of me while trying to figure out the cause of, because I would have forgotten it by then, so I thought it's easier to just unbind the keys first. I'd be more than happy if it turns out that's not needed. It certainly didn't cause any problems, but I think you can safely remove the unbind before your macro declarations. :-) -Kevin -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA signature.asc Description: PGP signature
Re: custom macro for "q" key
On 2021-08-30 09:20, Kevin J. McCarthy wrote: On Mon, Aug 30, 2021 at 05:28:35AM -0700, li...@ifohancroft.com wrote: bind index,pager c noop # Unbinding the key first, because the manual says that macros shouldn't be bound to keys that are already bound Would you mind pointing out where you got that information? As far as I know there is no need to do this, but maybe there is a problem I'm not aware of. Sorry. I meant to reply to the list. I'd be happy to. Apparently, I was wrong and it was not in the manual, but in the Mutt Guide: https://gitlab.com/muttmua/mutt/-/wikis/MuttGuide/Macros#how-to-use Under 'Usage: macro menu key sequence [ description ]', right before the first example, in the explanation of each part, there is the sentence: "Though you can use the bound keys too, that is not recommended!" I never knew what that is about and I've always forgot to ask. I thought there may be something about it, that may create a problem in a weird edge case, that if I encounter some day might confuse the hell out of me while trying to figure out the cause of, because I would have forgotten it by then, so I thought it's easier to just unbind the keys first. I'd be more than happy if it turns out that's not needed. Best Regards, IFo Hancroft
Re: custom macro for "q" key
On Mon, Aug 30, 2021 at 05:28:35AM -0700, li...@ifohancroft.com wrote: bind index,pager c noop # Unbinding the key first, because the manual says that macros shouldn't be bound to keys that are already bound Would you mind pointing out where you got that information? As far as I know there is no need to do this, but maybe there is a problem I'm not aware of. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA signature.asc Description: PGP signature
Re: custom macro for "q" key
On Mon, Aug 30, 2021 at 08:55:19AM +0200, Fourhundred Thecat wrote: macro index,pager c "?" Also, see , allowing instead just: bind index,pager c browse-mailboxes This has some small advantages with respect to the $browser_sticky_cursor setting. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA signature.asc Description: PGP signature
Re: custom macro for "q" key
Hi, You basically have to unbind q for index (perhaps also pager, depending on what you want) and create the same macro you already have for 'c', for 'q' as well. Then for 'browser' bind 'q' to to 'quit' again. So basically: bind index,pager c noop # Unbinding the key first, because the manual says that macros shouldn't be bound to keys that are already bound bind index,pager q noop # Same as above macro index,pager c "?" macro index,pager q "?" bind browser q quit Best Regards, IFo Hancroft On 30/08/2021 09:55, Fourhundred Thecat wrote: Hello, I have "q" key bound to "quit", and then I have custom macro bound to "c": macro index,pager c "?" When I start mutt, I automatically land in "Inbox", and "q" exits. When I press "c" anywhere in mutt, I get list of my folders, and can go into them. When inside any of the folder, "q" also exists mutt. I would like to change the behavior of "q", so that pressing "q" when I am inside any of the folders, mutt goes back to the list of folders (same as if I had pressed "c"). And only if I am already in the list of folders, then "q" exists mutt. What I want is similar to "q" behavior when in inbox, and composing message. When I cancel the compose with "q", I don't exit mutt, but instead land in Inbox again. I would like to keep that behavior. I guess, I will need to create custom macro for "q" ? Can anybody suggest how to do it? thank you,
custom macro for "q" key
Hello, I have "q" key bound to "quit", and then I have custom macro bound to "c": macro index,pager c "?" When I start mutt, I automatically land in "Inbox", and "q" exits. When I press "c" anywhere in mutt, I get list of my folders, and can go into them. When inside any of the folder, "q" also exists mutt. I would like to change the behavior of "q", so that pressing "q" when I am inside any of the folders, mutt goes back to the list of folders (same as if I had pressed "c"). And only if I am already in the list of folders, then "q" exists mutt. What I want is similar to "q" behavior when in inbox, and composing message. When I cancel the compose with "q", I don't exit mutt, but instead land in Inbox again. I would like to keep that behavior. I guess, I will need to create custom macro for "q" ? Can anybody suggest how to do it? thank you,