* On Tue, Jun 09, 2015 04:33PM -0400 Xu Wang ([email protected]) muttered: > On Tue, Jun 9, 2015 at 4:00 PM, Marcelo Laia <[email protected]> wrote: > > On 09/06/15 at 02:23pm, Michael Tatge wrote: > >> # extract all attachments > >> macro index,pager X '<enter-command> set my_wk=$wait_key; unset > >> wait_key<enter>\ > >> <pipe-message> ripmime --paranoid -i - -d ~/tmp/attachments<enter>\ > >> <enter-command> set wait_key=$my_wk<enter>' "save all attachments" > >> > >> macro attach X '<exit><enter-command> set my_wk=$wait_key; unset > >> wait_key<enter>\ > >> <pipe-message> ripmime --paranoid -i - -d ~/tmp/attachments<enter>\ > >> <enter-command> set wait_key=$my_wk<enter><display-message>\ > >> <view-attachments>' "save all attachments" > >> > > What is the difference between these two macros? > > difference is just that you can use the second macro in the attach > menu. The reason it is different is that it needs to exit, the attach > menu (back to pager menu?), then do the real work, then go back to > attach menu.
I wrote that macro with the index as the starting point in mind. But you describe it perfectly. :) Drop that <display-message> btw. That was a leftover from testing. > I actually wonder if the two macros could share some more code. That > is, can the attach macro call the first macro? One, if I'm not mistaken - the only way, to call a macro within a macro is to push it's key sequence. The downside here is that you need two different keys then. Besides I find it harder to read and debug. So you could try something like: macro index,pager ,X ... macro attach X '<exit><enter-command> push ,X<enter><view-attachments>' HTH, Michael -- PGP-Key-ID: EEE7D043 Jabber: [email protected]
