Re: mutt/2323: feature of creating personal my_variables should be documented
The following reply was made to PR mutt/2323; it has been noted by GNATS.
From: Alain Bench <veronatif@xxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc:
Subject: Re: mutt/2323: feature of creating personal my_variables should be
documented
Date: Fri, 7 Jul 2006 00:48:10 +0200 (CEST)
On Wednesday, July 5, 2006 at 2:35:02 +0200, Brendan Cully wrote:
> On Wednesday, 05 July 2006 at 02:15, Alain Bench wrote:
>>| :set my_variable=value ?charset
>>| don't resort: unknown variable
> fixed in CVS as of a minute ago.
Works fine! Much thanks to you.
>> print several ?vars
> perhaps a change-request in the BTS is in order...
Right, reported "wish: display multiple ?variables at once".
On Wednesday, July 5, 2006 at 13:25:01 +0200, Rocco Rutte wrote:
> Attached is take #1 for a patch.
Much thanks Rocco! I'm not English, but may I suggest a nuance:
| Only the set configuration command can be used to change the value,
| the unset and reset commands remove the definition.
Only the set configuration command can be used to define such a
custom my_variable, and to change its value; The unset and reset
commands remove the variable entirely.
> I recall Alain Bench having better examples
Ah? Forgot, yes: From Mutt-ng discussions when you created user_vars
and system vars, right. Well I grepped my sent box, and my "temporary
backup" example is in spirit already there in your patch. Exactly was
(adapted to $my_syntax):
| macro index <F42> '\
| <enter-command> set my_old_resolve=$resolve resolve=no<Enter>\
| ...multiple operations on one mail...\
| <enter-command> set resolve=$my_old_resolve &my_old_resolve<Enter>'
I could also provide a runtime sourced file or script example with:
| $ ~/bin/attributer de_DE.ISO-8859-15@euro
| set my_save_config_charset="$config_charset"
| set config_charset="utf-8"
| set attribution=" Am %d, %n schrieb:\n"
| set date_format="%A %-d %B %Y um %-H:%M:%S %Z"
| set locale="de_DE.ISO-8859-15@euro"
| set config_charset="$my_save_config_charset"
| unset my_save_config_charset
But I fear it's no better example than previous: Demonstrates new
place, but no different usage, and is too complex to be an efficient
my_var example. Humm... Perhaps keep only the reusable framing:
[muttrc]
| source ~/.mutt/aliases.latin1
[aliases.latin1]
| set my_save_config_charset="$config_charset"
| set config_charset="iso-8859-1"
|
| ...a bunch of aliases with Latin-1 names...
|
| set config_charset="$my_save_config_charset"
| unset my_save_config_charset
Yet another backup usage, but with the "\$" trick to defer variable
expansion from muttrc parsing time to macro execution time:
| macro pager <PageDown> "\
| <enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
| <next-page>\
| <enter-command> set pager_stop=\$my_old_pager_stop &my_old_pager_stop<Enter>"
Other usage: a poor-man's echo example:
| :set my_profile="is named $realname and my password is $imap_pass."
?my_profile
| my_profile="is named John Doe and my password is [censored]."
More usefull in-place:
| macro generic,pager <F42> "\
| <enter-command> set hostname=example.com \
| from=johnny@\$hostname \
| realname='John Doe' \
| signature=~/.mutt/sig.\$from \
| my_identity=\"selected is \$realname <\$from>\" ;\
| my_hdr Bcc: \$from ;\
| set ?my_identity ;\
| reset my_identity<Enter>" \
| "Select identity John Doe <johnny@xxxxxxxxxxx>"
|
| macro generic,pager <F142> "\
| <enter-command> set my_identity=\"selected is \$realname <\$from>\" \
| ?my_identity ;\
| reset my_identity<Enter>" \
| "Display currently selected identity"
OK: We need only one commented example per my_vars usage type:
-1) declare once reuse many
-2) backup
-3) poor-man's echo
What other types?
> I can push the branch out to my public mutt git tree for other to join
> in helping...
I think that initial doc writing and phrasing discussions might be
easier (at least to me) in simple text, in mails. So anyone can
participate, with just English language skills. And tagging xmling
patching be done at final step after agreement.
Bye! Alain.
--
As for the number of such vars, 640K should be enough for anybody.