On Tuesday 01.09.15 15:06, Joe wrote:
> Hi all,
> I' trying to set <right> key such that when I press it
> mutt execute some commands and then it redefines same
> <right> key.
>
> Let's take a look closer to my muttrc attempt:
> ---
> macro index 'alone' \
> "<tag-subthread><limit>~T\n<tag-subthread>" "hide other threads"
>
> macro index <right> \
> "<enter-command> macro index '<right>' <display-message>; push alone"
> ---
>
>
> [...]
>
>
> So I think that when I found a way to prevent/escape "<right>" key then
> this issue will be solved.
>
>
> Can you help me to find a way to re-use <right> key?
>
Perhaps I found a way to let reuse <right> key:
---
macro index 'alone' \
"<tag-subthread><limit>~T\n<tag-subthread>" "hide other threads"
macro index <right> \
'<enter-command> macro index \<right\> <display-message>; push alone'
---
Now If I press <right> key in index menu selecting a thread with
more than one message , mutt command prompt line is filled with:
---
: macro index \<right\> <display-message>; push alone
---
And If I press Enter to confirm the sequence, Mutt hides all other
thread and show only current thread uncollapsed and more...
If I now select a message of this shown thread and press right arrow
Mutt display the message as expected.
Then I can exit from the current message and return to current thread
view, to select an other message and press again right arrow key to
open and display it.
So, my answer seems to be solved:
single quotes and backslashes ( \<right\> ) are needed to preserve
<right> string.
I wish to report a part of my muttrc in which I setted right and left
arrow keys to work together:
---
set hide_top_limited=yes
macro index 'alone' \
"<tag-subthread><limit>~T\n<tag-subthread>" "hide other threads"
macro index onethr \
'<enter-command> macro index \<right\> <display-message>; \
push alone<enter>'
macro index <right> onethr
macro index <left> \
'<enter-command> push <limit>all\n<collapse-all>; \
macro index \<right\> onethr<enter>'
---
I used macros as variables in a certain sense... I took that idea by reading:
- (ab)use "macros" as variables
http://dev.mutt.org/trac/wiki/ConfigTricks
- Toggle ROT13 decoding with ESC r
http://dev.mutt.org/trac/wiki/MacroSamples
Theoretically "alone" macro is not really needed, but without it I
cannot make it working due to the presence of ~T...
The above few lines may be not coded as cleanly as one expected
but the let Mutt works well for my taste.
Now I'm able to browse around threads, messages, open and close them
with just three fingers! :)
In a similar way Tin Newsreader works on newsgroups/threads/articles.
right arrow: enter mailbox/ focus a thread/ open messages
left arrow: exit from message display / from thread focus
/ from mailbox (todo..)
Hope this could be useful also for some other mutt users.
Any idea suggest, comment and so on is welcome... Let me
know what do you think about! :)
Bye