From: Rocco Rutte Date: Sat, 20 Jun 2009 13:22:30 +0000 (+0200) Subject: Manual: Clarify and extend variable type conversion section X-Git-Tag: neomutt-20160307~540 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8362483196e98aada631814f98486ffd69d042d3;p=neomutt Manual: Clarify and extend variable type conversion section --- diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 85ef7ae39..900b6b240 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -3998,14 +3998,6 @@ backtick expansion), this feature can be used to make configuration files more readable. - -Whenever a user-defined variable is used in an assignment for a built-in -variable or vice versa, Mutt string representations to do the -assignment. As a result, a user-defined variable can be assigned to any -other variable under the restriction that its content is valid. See the -following section for examples. - - @@ -4077,13 +4069,28 @@ the set configuration command, preventing Mutt from recording the macro's commands into its history. + + + + + +Type Conversions + -The following example demonstrates type conversion when using -user-defined variables. +Variables are always assigned string values which Mutt parses into its +internal representation according to the type of the variable, for +example an integer number for numeric types. For all queries (including +$-expansion) the value is converted from its internal type back +into string. As a result, any variable can be assigned any value given +that its content is valid for the target. This also counts for custom +variables which are of type string. In case of parsing errors, mutt will +print error messages as it would have if the new value was specified +literally and not through another variable. +demonstrates type conversions. -Type conversion in user-defined variables +Type conversions using variables set my_lines = "5" # value is string "5" set pager_index_lines = $my_lines # value is integer 5 @@ -4091,11 +4098,46 @@ set pager_index_lines = $my_lines # value is integer 5 set my_sort = "date-received" # value is string "date-received" set sort = "last-$my_sort" # value is sort last-date-received -set my_inc = $read_inc # value is string "10" (default) +set my_inc = $read_inc # value is string "10" (default of $read_inc) +set my_foo = $my_inc # value is string "10" - + +These assignments are all valid. If, however, the value of +$my_lines would have been +five (or something else that cannot be parsed into a +number), the assignment to +$pager_index_lines would have +produced an error message. + + + +Type conversion applies to all configuration commands which take +arguments. But please note that every expanded value of a variable is +considered just a single token. A working example is: + + + +set my_pattern = "~A" +set my_number = "10" + +# same as: score ~A +10 +score $my_pattern +$my_number + + +What does not work is: + + + +set my_mx = "+mailbox1 +mailbox2" +mailboxes $my_mx +mailbox3 + + +because the value of $my_mx is +interpreted as a single mailbox named +mailbox1 +mailbox2 +and not two distinct mailboxes. +