Toggling between two values of a string variable?
John Hawkinson
jhawk at alum.mit.edu
Sun Jun 28 00:48:15 UTC 2020
I feel like this is a silly question, but here goes:
I've recently found myself toggling back and forth the "postponed" variable to deal with either postponing messages locally (no network dependancy!) or dealing with postponed messages in a remote IMAP mailbox for collaboration with a mobile client (e.g. Gmail's Drafts folder).
Experience has shown there is no one right answer, I need to use one definition of postponed sometimes, and one the other.
Ideally I'd like to bind a key to toggle between two values of a string variable. There doesn't seem to be a good way to accomplish this -- is there a trick?
As an alternative, I (notionally) bound ,a to :set postponed to one value, and ,b to :set it to another. I do not love this. Both display the result (:set ?postponed\n) so I can at least see what I've done.
I realize on some level this is plea for macro/scripting language with true conditionals, and we're not going to get there anytime soon. The last time I had a problem of this nature in mutt I bound the macro to ! execute a perl script that did its thing and then made use of the fact that mutt was running under screen(1) and used screen's "slowpaste" to tell mutt to :source a temporary file that redefined things as desired. Since my mutt isn't running under screen anymore (although I suppose I could), this approach doesn't work, and it was pretty janky anyhow.
I guess it's collateral, but I was surprised that I couldn't get :toggle to work with a $my_foo variable. I guess it would not really have helped me make progress, but seemed like it could be a building block in some more complex scheme.
Thanks for any thoughts.
--
jhawk at alum.mit.edu
John Hawkinson
More information about the Mutt-users
mailing list