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: Rocco Rutte <pdmef@xxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc:
Subject: Re: mutt/2323: feature of creating personal my_variables should be
documented
Date: Wed, 5 Jul 2006 11:19:02 +0000
--K8nIJk4ghYZn606h
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline
Hi,
* blacktrash@xxxxxxx [06-07-02 10:39:14 +0200] wrote:
>User can create own variables using `my_' prefix.
>This is not mentioned in the docs while mutt should bark proudly about
>this phantastic improvement.
Attached is take #1 for a patch.
As the other patch for the history documentation, it tries to add more
sections to find things easier via the table of contents.
Should there be need for further tuning (I recall Alain Bench having
better examples than me), I can push the branch out to my public mutt
git tree for other to join in helping...
bye, Rocco
--
:wq!
--K8nIJk4ghYZn606h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-doc-myvar
diff --git a/doc/manual.xml.head b/doc/manual.xml.head
index 206960c..1d896fa 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -2808,7 +2808,15 @@ spam "^From: .*MAILER-DAEMON" "999
</sect1>
<sect1 id="set">
-<title>Setting variables</title>
+<title>Setting and Querying Variables</title>
+
+<sect2 id="set-commands">
+<title>Commands</title>
+
+<para>
+The following commands are available for use in configuration files as well as
+interactively to manipulate and query variable's values:
+</para>
<para>
<literallayout>
@@ -2894,6 +2902,77 @@ With the <literal>reset</literal> comman
which allows you to reset all variables to their system defaults.
</para>
+</sect2>
+
+<sect2 id="set-myvar">
+<title>Self-defined variables</title>
+
+<sect3 id="set-myvar-intro">
+<title>Introduction</title>
+
+<para>
+Besides the variables listed in the <link linkend="variables"
+>Configuration variables</link> section, mutt supports user-defined
+variables if a name is prefixed with <literal>my_</literal> as
+in, for example, <literal>my_cfgdir</literal>.
+</para>
+
+<para>
+Only the <literal>set</literal> configuration command can be used to
+change the value, the <literal>unset</literal> and <literal>reset</literal>
+commands remove the definition.
+</para>
+
+<para>
+In connection with mutt expanding configuration variables just as
+environment variables (except for <link
+linkend="shell-escape">shell-escape</link> command), this feature can be
+used to make configuration more readable.
+</para>
+
+</sect3>
+
+<sect3 id="set-myvar-examples">
+<title>Examples</title>
+
+<para>
+The following example defines and uses the variable
<literal>my_cfgdir</literal>
+to abbreviate the calls of the <link linkend="source">source</link> command:
+</para>
+
+<para>
+<screen>
+set my_cfgdir = $HOME/mutt/config
+
+source $my_cfgdir/hooks
+source $my_cfgdir/macros
+# more source commands...
+</screen>
+</para>
+
+<para>
+A custom variable can also be used in macros to backup the current value
+of another variable. In the following example, the value of the
+<link linkend="delete">$delete</link> is changed temporarily
+while its original value is saved as <literal>my_delete</literal>.
+After the macro has executed all commands, the original value of <link
+linkend="delete">$delete</link> is restored.
+</para>
+
+<para>
+<screen>
+macro pager , x '\
+<enter-command>set my_delete=$delete<enter>\
+<enter-command>set delete=yes<enter>\
+...\
+<enter-command>set delete=$my_delete<enter>'
+</screen>
+</para>
+
+</sect3>
+
+</sect2>
+
</sect1>
<sect1 id="source">
@@ -4907,7 +4986,7 @@ since it is not itself subject to any fu
<para>
<screen>
-text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \
+text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \
&& test "`echo $charset | tr '[A-Z]' '[a-z]'`" != iso-8859-1
</screen>
@@ -5063,7 +5142,7 @@ print command:
<screen>
image/*; xv %s
-image/gif; ; print= anytopnm %s | pnmtops | lpr; \
+image/gif; ; print= anytopnm %s | pnmtops | lpr; \
nametemplate=%s.gif
</screen>
@@ -5214,7 +5293,7 @@ image/jpeg;xv %s; x-mozilla-flags=intern
# Use xv to view images if I'm running X
# In addition, this uses the \ to extend the line and set my editor
# for images
-image/*;xv %s; test=RunningX; \
+image/*;xv %s; test=RunningX; \
edit=xpaint %s
# Convert images to text using the netpbm tools
--K8nIJk4ghYZn606h--