Hi, all

I asked some question yesterday about how to redefine the same key
using a macro. Subject title was:

[Macro] Redefine the same key (<right> key)

Finally I had found a way to make it work "almost" as expected:
my not working old macro needed sequence to be enclosed in single
quotes instead in double ones.

Now I've upgrade yesterday macros to control index menu better.
So I decided to share them here so that you can comment, add ideas
and so on...

Expected behaviour when arrow keys are pressed:

1. When I enter in a mailbox I'm in front of mutt index menu:
   I've configured it to show one thread per line, all threads
   collapsed whit %M flag in index_format, so I can distinguish
   single message by multi message threads.

2. I want to close current mailbox by type "left" key and return
   to browser menu with all mailboxes listed one per line.

3. When I'm selecting a multi messages thread I want to view it
   expanded in a clean screen by pressing "right" key. The other
   threads will be hidden.
   If I'm selecting a single message thread I want that same "right"
   key just display that message (so entering in pager menu).
   I have not found a solution for this  conditional behaviour.
   To summarize:
   ---
   if thread has just one message
     display it
   else
     hide other threads
     expand current thread
   endif
   ---

4. When I'm in front of screen that contains just one multi message
   thread expanded, I want to return to my all thread screen by
   pressing "left" key.
   And I want to open selected message by pressing right key.


Here a scheme: 

enter in mailbox (from browser menu, I use right key to enter in
selected mailbox).
---
left  key ---> quit mailbox and return to browser menu
right key ---> display message if single message thread is selected
  |
  --> show expanded multi messages thread alone
          |
          --> right key ---> open selected message
          --> left key ---> return to all threads (collapsed) view
---



And here we have my macros from my muttrc:
---
set hide_top_limited=yes


macro index onethr "<tag-thread><limit>~T\n<tag-thread>"

macro index allthr "<limit>all\n<collapse-all>"

macro index st1lft '<enter-command> push allthr; \
        macro index \<right\> defrgt; \
        macro index \<left\> deflft<enter>'

macro index defrgt '<enter-command> push onethr; \
        macro index \<right\> <display-message>; \
        macro index \<left\> st1lft<enter>'

macro index deflft '<change-folder>?'

macro index <right> defrgt

macro index <left> deflft
---

As I said, the only thing missing is the conditional behaviour
of <right> key:
with my above macro if I open a single message thread, mutt
first shows that "thread" alone in one screen, and then I've
to press again <right> to display the only message contained.

It's not a great problem, but if mutt had conditional actions
support I would have solved also this point.

So, If you have any hints, suggests, comments, welcome!
Hope this message will be useful.  :)

Reply via email to