Re: wiki macro page expansion (was Re: The wiki lies about macros and tags.)
On Sun, Jul 22, 2012 at 08:44:32PM -0700, Robin Lee Powell wrote: If no-one comments further, I'm going to see if I have perms to change the wiki page with this tutorial. SCNR. A good demonstration with the problems of top posting, and no trimming -- If you're not careful, the newspapers will have you hating the people who are being oppressed, and loving the people who are doing the oppressing. --- Malcolm X
Re: The wiki lies about macros and tags.
* On 21 Jul 2012, Chris Bannister wrote: On Thu, Jul 19, 2012 at 01:04:23PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. It's not false or useless, but it is incomplete. What it means is that if a macro contains two or more operations, and you press your tag-prefix keystroke before executing the macro, it will execute the first operation on each tagged entry and then execute each subsequent operation on the current entry, whichever entry happens to be current after the first operation is done. Very easy to understand. So why not say it that way. To be clear, I have no stake in the wiki contents, I'm just offering comments. I'd be fine with the text I wrote above, but Robin proposed something else that is somewhat longer. Some further discussion on the list might be appropriate, if anyone has additional thoughts -- ultimately it's the people doing the work and contributing ideas in discussion who make the decisions. Or someone could decide to fork the project so they can change the documentation without discussion. (Not really. That's a jab at mutt-kz, not at anyone here.) -- David Champion • d...@uchicago.edu • IT Services • University of Chicago
Re: wiki macro page expansion (was Re: The wiki lies about macros and tags.)
=- Robin Lee Powell wrote on Sun 22.Jul'12 at 20:44:32 -0700 -= If no-one comments further, I'm going to see if I have perms to change the wiki page with this tutorial. a) have you considered tag-prefix-cond? b) if you change the wiki, please do so at dev.mutt.org, the content has moved there and the old one will be shutdown soon. =- Robin Lee Powell wrote on Thu 19.Jul'12 at 13:00:09 -0700 -= It's not false or useless, but it is incomplete. Sorry, I started my big mail before I saw this. :) What it means is that if a macro contains two or more operations, and you press your tag-prefix keystroke before executing the macro, it will execute the first operation on each tagged entry and then execute each subsequent operation on the current entry, whichever entry happens to be current after the first operation is done. I got into documentation mode and suggested some rather extensive additions; please let me know what you think. David's has it pretty compact, just for the facts I'd go for the smaller the better, but I guess casual techies might appreciate the examples. Just remember to use the new wiki. -- © Rado S. -- You must provide YOUR effort for your goal! EVERY effort counts: at least to show your attitude. You're responsible for ALL you do: you get what you give.
Re: wiki macro page expansion (was Re: The wiki lies about macros and tags.)
If no-one comments further, I'm going to see if I have perms to change the wiki page with this tutorial. -Robin On Thu, Jul 19, 2012 at 12:58:34PM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 10:55:07AM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 10:48:03AM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 12:44:31PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and In what way, specifically? The statements appear to be correct and there are no functional examples (only illustrative ones), so it's hard to infer what's incorrect. If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. Based on that statement, given the following macro: macro index ,t tag-entry I would expect the following sequence of characters to error out: ttt;,t But in fact it works perfectly. It just occured to me that it may be that it is intended to mean that given: macro index ,t tag-entry this won't work: macro index ,x tag-prefix,t But in fact that is also false; all 4 of the following work exactly as you'd expect: macro index ,t t macro index ,T tag-entry macro index ,x tag-prefix,t macro index ,X tag-prefix,T at least in 1.5.21, where I just tested them. And now I think I understand what it's *actually* trying to say. I took: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! to mean that *no* macros *ever* work with tags unless set to do so explicitely, but it means that *some* macros will do unpexpected things. I'm going to suggest some wording here that I'd like to put in that section of the wiki, and y'all can tell me if it's halfway decent. Tags, Advancement, And Other Macro Surprises All macros devolve in the end, essentially, to a sequence of keystrokes sent to mutt. This means that working with tagged messages in macros can be tricky, at least unless you have auto_tag turned on, because if you simply hit the tag-prefix key (default ;) before the macro, the tag-prefix key will only apply to the first action. If your macro does more than one thing, each seperate thing that it does must be tag-prefixed seperately. Here's an example; this (totally useless) macro: macro index ,g 'pipe-entrywc -lenterdelete-message' useless: count lines, throw away the count, and then delete pipes a message to a shell command and then deletes it. If, however, you use tab-prefix first (i.e. ;,g), it doesn't pipe each message to the shell and then delete them, it pipes them all to the shell and then deletes the one under the cursor. In other words, assuming default bindings and using enter to stand in for hitting the enter key, the keystrokes: |wc -lenterd become: ;|wc -lenterd which pipes all the messages but only deletes one message (and not any of the ones you had tagged, probably, but rather the one under the cursor!) and not: ;|wc -lenter;d which pipes and deletes all of them, as you might expect. A slightly tricky bit there is that pipe-entry asks for user input, which you might not want in a macro; this can be handled by temporarily disabling that behaviour and then (assuming you want it on) turning it back on, like so: macro index ,G 'enter-commandset wait_key=noenterpipe-entrywc -lenterdelete-messageenter-commandset wait_key=noenter' useless: count lines, don't wait, throw away the count, and then delete The wait_key bit is to stop it from explicitely asking you to press enter. This behaves even worse with tag-prefix, because what you end up with is: ;:set wait_key=noenter|wc -lenterd:set wait_key=yesenter Which is a problem because as soon as you type the :, the prefix-ness just gets completely lost; you might as well have not even typed ;. For some macros, there's no problem; this macro will work just fine with tag-prefix: macro index ,s 'save-message=spamenter' Dump to spam folder Because it only performs one action, with tag prefix this turns into: ;s=spamenter which works perfectly. If you do need a macro that performs multiple actions, though, what you'll need to do is have a version that expects no tags, and a versian that accepts tags. [INSERT CURRENT CONTENTS OF Special usage: applying to several tagged
Re: The wiki lies about macros and tags.
On Thu, Jul 19, 2012 at 01:04:23PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. It's not false or useless, but it is incomplete. What it means is that if a macro contains two or more operations, and you press your tag-prefix keystroke before executing the macro, it will execute the first operation on each tagged entry and then execute each subsequent operation on the current entry, whichever entry happens to be current after the first operation is done. Very easy to understand. So why not say it that way. The current wording is correct in a logical sense, but not in a practical sense. Perhaps it should say: If you define a macro to work with a single entry, then it can not **necessarily** be applied to tagged entries just by using tag-prefixmacro-key! Not as easy to understand Or: If you define a macro to perform multiple actions, then it can not be applied to tagged entries just by using tag-prefixmacro-key! Not as easy to understand tag-prefix affects only the next action performed by a macro, not the entire macro as a whole. Not as easy to understand. -- If you're not careful, the newspapers will have you hating the people who are being oppressed, and loving the people who are doing the oppressing. --- Malcolm X
The wiki lies about macros and tags.
The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and should be entirely removed or cordoned off. I tried, and I cannot replicate the old behaviour at all. Does anyone know when this behaviour changed? -Robin -- http://singinst.org/ : Our last, best hope for a fantastic future. .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni li'u
Re: The wiki lies about macros and tags.
On Thu, Jul 19, 2012 at 10:30:42AM -0700, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and should be entirely removed or cordoned off. 1.5.18, too. -Robin
Re: The wiki lies about macros and tags.
* On 19 Jul 2012, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and In what way, specifically? The statements appear to be correct and there are no functional examples (only illustrative ones), so it's hard to infer what's incorrect. -- David Champion • d...@uchicago.edu • IT Services • University of Chicago
Re: The wiki lies about macros and tags.
On Thu, Jul 19, 2012 at 12:44:31PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and In what way, specifically? The statements appear to be correct and there are no functional examples (only illustrative ones), so it's hard to infer what's incorrect. If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. Based on that statement, given the following macro: macro index ,t tag-entry I would expect the following sequence of characters to error out: ttt;,t But in fact it works perfectly. -Robin -- http://singinst.org/ : Our last, best hope for a fantastic future. .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni li'u
Re: The wiki lies about macros and tags.
On Thu, Jul 19, 2012 at 10:48:03AM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 12:44:31PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and In what way, specifically? The statements appear to be correct and there are no functional examples (only illustrative ones), so it's hard to infer what's incorrect. If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. Based on that statement, given the following macro: macro index ,t tag-entry I would expect the following sequence of characters to error out: ttt;,t But in fact it works perfectly. It just occured to me that it may be that it is intended to mean that given: macro index ,t tag-entry this won't work: macro index ,x tag-prefix,t But in fact that is also false; all 4 of the following work exactly as you'd expect: macro index ,t t macro index ,T tag-entry macro index ,x tag-prefix,t macro index ,X tag-prefix,T at least in 1.5.21, where I just tested them. -Robin
Re: The wiki lies about macros and tags.
* On 19 Jul 2012, Robin Lee Powell wrote: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. It's not false or useless, but it is incomplete. What it means is that if a macro contains two or more operations, and you press your tag-prefix keystroke before executing the macro, it will execute the first operation on each tagged entry and then execute each subsequent operation on the current entry, whichever entry happens to be current after the first operation is done. The current wording is correct in a logical sense, but not in a practical sense. Perhaps it should say: If you define a macro to work with a single entry, then it can not **necessarily** be applied to tagged entries just by using tag-prefixmacro-key! Or: If you define a macro to perform multiple actions, then it can not be applied to tagged entries just by using tag-prefixmacro-key! Or: tag-prefix affects only the next action performed by a macro, not the entire macro as a whole. -- David Champion • d...@uchicago.edu • IT Services • University of Chicago
wiki macro page expansion (was Re: The wiki lies about macros and tags.)
On Thu, Jul 19, 2012 at 10:55:07AM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 10:48:03AM -0700, Robin Lee Powell wrote: On Thu, Jul 19, 2012 at 12:44:31PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: The section about tags in http://wiki.mutt.org/?MuttGuide/Macros is flat-out wrong in 1.5.21 and 1.5.20, as far as I can tell, and In what way, specifically? The statements appear to be correct and there are no functional examples (only illustrative ones), so it's hard to infer what's incorrect. If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. Based on that statement, given the following macro: macro index ,t tag-entry I would expect the following sequence of characters to error out: ttt;,t But in fact it works perfectly. It just occured to me that it may be that it is intended to mean that given: macro index ,t tag-entry this won't work: macro index ,x tag-prefix,t But in fact that is also false; all 4 of the following work exactly as you'd expect: macro index ,t t macro index ,T tag-entry macro index ,x tag-prefix,t macro index ,X tag-prefix,T at least in 1.5.21, where I just tested them. And now I think I understand what it's *actually* trying to say. I took: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! to mean that *no* macros *ever* work with tags unless set to do so explicitely, but it means that *some* macros will do unpexpected things. I'm going to suggest some wording here that I'd like to put in that section of the wiki, and y'all can tell me if it's halfway decent. Tags, Advancement, And Other Macro Surprises All macros devolve in the end, essentially, to a sequence of keystrokes sent to mutt. This means that working with tagged messages in macros can be tricky, at least unless you have auto_tag turned on, because if you simply hit the tag-prefix key (default ;) before the macro, the tag-prefix key will only apply to the first action. If your macro does more than one thing, each seperate thing that it does must be tag-prefixed seperately. Here's an example; this (totally useless) macro: macro index ,g 'pipe-entrywc -lenterdelete-message' useless: count lines, throw away the count, and then delete pipes a message to a shell command and then deletes it. If, however, you use tab-prefix first (i.e. ;,g), it doesn't pipe each message to the shell and then delete them, it pipes them all to the shell and then deletes the one under the cursor. In other words, assuming default bindings and using enter to stand in for hitting the enter key, the keystrokes: |wc -lenterd become: ;|wc -lenterd which pipes all the messages but only deletes one message (and not any of the ones you had tagged, probably, but rather the one under the cursor!) and not: ;|wc -lenter;d which pipes and deletes all of them, as you might expect. A slightly tricky bit there is that pipe-entry asks for user input, which you might not want in a macro; this can be handled by temporarily disabling that behaviour and then (assuming you want it on) turning it back on, like so: macro index ,G 'enter-commandset wait_key=noenterpipe-entrywc -lenterdelete-messageenter-commandset wait_key=noenter' useless: count lines, don't wait, throw away the count, and then delete The wait_key bit is to stop it from explicitely asking you to press enter. This behaves even worse with tag-prefix, because what you end up with is: ;:set wait_key=noenter|wc -lenterd:set wait_key=yesenter Which is a problem because as soon as you type the :, the prefix-ness just gets completely lost; you might as well have not even typed ;. For some macros, there's no problem; this macro will work just fine with tag-prefix: macro index ,s 'save-message=spamenter' Dump to spam folder Because it only performs one action, with tag prefix this turns into: ;s=spamenter which works perfectly. If you do need a macro that performs multiple actions, though, what you'll need to do is have a version that expects no tags, and a versian that accepts tags. [INSERT CURRENT CONTENTS OF Special usage: applying to several tagged entries HERE] Another surprise is that most commands in mutt at the index level move to the next message, at least with default settings, and this is true when they are invoked as macros as well. This means that: macro index ,t 'toggle-newdelete-message' broken: toggle new, then delete something else is
Re: The wiki lies about macros and tags.
On Thu, Jul 19, 2012 at 01:04:23PM -0500, David Champion wrote: * On 19 Jul 2012, Robin Lee Powell wrote: If you define a macro to work with a single entry, then it can not be applied to tagged entries just by using tag-prefixmacro-key!!! is flat-out false in every version of mutt I have access to. This means that the entire section Special usage: applying to several tagged entries is both false and useless. It's not false or useless, but it is incomplete. Sorry, I started my big mail before I saw this. :) What it means is that if a macro contains two or more operations, and you press your tag-prefix keystroke before executing the macro, it will execute the first operation on each tagged entry and then execute each subsequent operation on the current entry, whichever entry happens to be current after the first operation is done. The current wording is correct in a logical sense, but not in a practical sense. Perhaps it should say: If you define a macro to work with a single entry, then it can not **necessarily** be applied to tagged entries just by using tag-prefixmacro-key! Or: If you define a macro to perform multiple actions, then it can not be applied to tagged entries just by using tag-prefixmacro-key! Or: tag-prefix affects only the next action performed by a macro, not the entire macro as a whole. I got into documentation mode and suggested some rather extensive additions; please let me know what you think. -Robin -- http://singinst.org/ : Our last, best hope for a fantastic future. .i ko na cpedu lo nu stidi vau loi jbopre .i danfu lu na go'i li'u .e lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni li'u