<<< Date Index >>>     <<< Thread Index >>>

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: Sat, 8 Jul 2006 20:43:13 +0200 (CEST)

  On Friday, July 7, 2006 at 13:55:02 +0200, Christian Ebert wrote:
 
 > Thank you all for looking into this.
 
     And thanks to you and Paul for the heads-up!
 
 
 >>| <enter-command> set resolve=$my_old_resolve &my_old_resolve<Enter>
 > I don't understand the &my_old_resolve.
 
     As you saw, that's the short for reset. But really used to *unset*,
 it should tell unset... In context the "no" prefix seems unclear to me
 (set nomy_old_resolve). Please rewrite to the longer, but much more
 clear example, and meaning what it tells it does what it means to do:
 
 | <enter-command> set resolve=$my_old_resolve; unset my_old_resolve<Enter>
 
     In retrospect usage of &var was a perfectly cryptic way to lose doc
 readers in the forest. My stupid mistake: Thank you for spotting it.
 
 
 >> the "\$" trick to defer variable expansion from muttrc parsing time
 >> to macro execution time:
 
     Let me try an explanation:
 
  -1) $var and "$var" expand at command parsing time.
 
  -2) \$var, "\$var", and '$var' do not expand never. Really never.
 
  -3) But parsing form #2 removes one level of quoting, transmutating it
 to form #1. Later, at macro or hook execution time, the <enter-command>
 receives this 1st form, parses it, and expands it. Form #2 actually
 defers expansion.
 
     I tried hard to put this in words suitable for a manual, but
 produced nothing valuable. I have to admit it's a hard exercise...
 Either too programer oriented, too verbose, or too fuzzy to be true, and
 anyway subunderstandable. Any English takers?
 
 
 > I also use something that is perhaps illegal:
 >| set my_datesort="uncollapse_jump=no sort=date sort_aux=date"
 >| folder-hook test "set $my_datesort"
 
     That line is immediately expanded, and exactly equivalent to:
 
 | folder-hook test "set uncollapse_jump=no sort=date sort_aux=date"
 
     When the hook is triggered, this straight set command is parsed and
 executed. No expansion involved at this stage.
 
     BTW Tamo's patch-*.tamo.comval.* would tremendously help to see
 what's really happening: You would clearly see the folder-hook list, as
 stored internally by Mutt.
 
 
 >| folder-hook test "source testhook"
 > where file testhook contains "set $my_datesort".
 
     Right: Illegal I fear. Simplified to remove hook and source, this is
 equivalent to:
 
 | set my_datesort="uncollapse_jump=no sort=date sort_aux=date"
 | set $my_datesort
 
     Which shouts:
 
 | Error in /tmp/mrc, line 57: uncollapse_jump=no sort=date sort_aux=date: 
unknown variable
 | source: errors in /tmp/mrc
 
     May seem inconsistent with backtick substitution. Do work:
 
 | set `echo "sort=from"`
 
     ...and even:
 
 | `echo "set sort=from"`
 
     And in some degenerate cases is even self-inconsistent:
 
 | unset uncollapse_jump
 | set my_datesort="uncollapse_jump"
 | set $my_datesort
 
     ...does set uncollapse_jump.
 
 
 Bye!   Alain.