]> granicus.if.org Git - neomutt/commitdiff
docs: ifdef
authorRichard Russon <rich@flatcap.org>
Mon, 1 Aug 2016 23:39:25 +0000 (00:39 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 18 Aug 2016 14:51:01 +0000 (15:51 +0100)
doc/manual.xml.head
doc/muttrc.ifdef [new file with mode: 0644]
doc/vimrc.ifdef [new file with mode: 0644]

index be7bf55d6516abf1b4ca74d5b668fcc238ae345e..937c853f13daa98365b1350f8238ef3317b608c8 100644 (file)
@@ -9067,6 +9067,167 @@ set index_format='%4C %Z %&lt;[y?%&lt;[m?%&lt;[d?%[%H:%M ]&amp;%[%a %d]&gt;&amp;
   </sect2>
 </sect1>
 
+<sect1 id="ifdef">
+  <title>Ifdef Patch</title>
+  <subtitle>Conditional config options</subtitle>
+
+  <sect2 id="ifdef-patch">
+    <title>Patch</title>
+
+    <para>
+      To check if Mutt supports <quote>ifdef</quote>, look for
+      <quote>patch-ifdef</quote> in the mutt version.
+      See: <xref linkend="mutt-patches"/>.
+    </para>
+
+    <itemizedlist>
+      <title>Dependencies:</title>
+      <listitem><para>mutt-1.6.2</para></listitem>
+    </itemizedlist>
+
+    <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
+  </sect2>
+
+  <sect2 id="ifdef-intro">
+    <title>Introduction</title>
+
+    <para>
+      The <quote>ifdef</quote> patch introduces three new commands to
+      Mutt and allow you to share one config file between versions of Mutt
+      that may have different features compiled in.
+    </para>
+
+<screen>
+ifdef  symbol config-command [args...]  <emphasis role="comment"># If a symbol is defined</emphasis>
+ifndef symbol config-command [args...]  <emphasis role="comment"># If a symbol is not defined</emphasis>
+finish                                  <emphasis role="comment"># Finish reading the current file</emphasis>
+</screen>
+
+    <para>
+      Here a symbol can be a <link linkend="variables">$variable</link>,
+      <link linkend="functions">&lt;function&gt;</link>,
+      <link linkend="commands">command</link> or compile-time symbol, such
+      as <quote>USE_IMAP</quote>.
+    </para>
+
+        <para>
+            <literal>finish</literal> is particularly useful when combined with
+            <literal>ifndef</literal>. e.g.
+        </para>
+
+<screen>
+<emphasis role="comment"># Sidebar config file</emphasis>
+ifndef USE_SIDEBAR finish
+</screen>
+
+  </sect2>
+
+<!--
+  <sect2 id="ifdef-variables">
+    <title>Variables</title>
+    <para>None</para>
+  </sect2>
+
+  <sect2 id="ifdef-functions">
+    <title>Functions</title>
+    <para>None</para>
+  </sect2>
+-->
+
+  <sect2 id="ifdef-commands">
+    <title>Commands</title>
+    <cmdsynopsis>
+      <command>ifdef</command>
+      <arg choice="plain">
+        <replaceable class="parameter">symbol</replaceable>
+      </arg>
+      <arg choice="plain">
+        <replaceable class="parameter">"config-command [args]"</replaceable>
+      </arg>
+      <command>ifndef</command>
+      <arg choice="plain">
+        <replaceable class="parameter">symbol</replaceable>
+      </arg>
+      <arg choice="plain">
+        <replaceable class="parameter">"config-command [args]"</replaceable>
+      </arg>
+      <command>finish</command>
+    </cmdsynopsis>
+  </sect2>
+
+<!--
+  <sect2 id="ifdef-colors">
+    <title>Colors</title>
+    <para>None</para>
+  </sect2>
+
+  <sect2 id="ifdef-sort">
+    <title>Sort</title>
+    <para>None</para>
+  </sect2>
+-->
+
+  <sect2 id="ifdef-muttrc">
+    <title>Muttrc</title>
+<screen>
+<emphasis role="comment"># Example Mutt config file for the 'ifdef' feature.
+# This feature introduces three useful commands which allow you to share
+# one config file between versions of Mutt that may have different
+# features compiled in.
+#     ifdef  symbol config-command [args...]
+#     ifndef symbol config-command [args...]
+#     finish
+# The 'ifdef' command tests whether Mutt understands the name of
+# a variable, function, command or compile-time symbol.
+# If it does, then it executes a config command.
+# The 'ifndef' command tests whether a symbol does NOT exist.
+# The 'finish' command tells Mutt to stop reading current config file.
+# If the 'trash' variable exists, set it.</emphasis>
+ifdef trash 'set trash=~/Mail/trash'
+<emphasis role="comment"># If the 'tag-pattern' function exists, bind a key to it.</emphasis>
+ifdef tag-pattern 'bind index &lt;F6&gt; tag-pattern'
+<emphasis role="comment"># If the 'imap-fetch-mail' command exists, read my IMAP config.</emphasis>
+ifdef imap-fetch-mail 'source ~/.mutt/imap.rc'
+<emphasis role="comment"># If the compile-time symbol 'USE_SIDEBAR' does not exist, then
+# stop reading the current config file.</emphasis>
+ifndef USE_SIDEBAR finish
+<emphasis role="comment"># vim: syntax=muttrc</emphasis>
+</screen>
+  </sect2>
+
+  <sect2 id="ifdef-see-also">
+    <title>See Also</title>
+
+    <itemizedlist>
+      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
+    </itemizedlist>
+  </sect2>
+
+  <sect2 id="ifdef-known-bugs">
+    <title>Known Bugs</title>
+    <para>None</para>
+  </sect2>
+
+  <sect2 id="ifdef-credits">
+    <title>Credits</title>
+    <itemizedlist>
+    <listitem><para>Cedric Duval <email>cedricduval@free.fr</email></para></listitem>
+    <listitem><para>Matteo F. Vescovi <email>mfvescovi@gmail.com</email></para></listitem>
+    <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
+    </itemizedlist>
+  </sect2>
+</sect1>
+
 <sect1 id="sidebar">
   <title>Sidebar</title>
   <subtitle>Overview of mailboxes</subtitle>
@@ -10176,6 +10337,18 @@ The following are the commands understood by Mutt:
 </cmdsynopsis>
 </listitem>
 
+<listitem>
+<cmdsynopsis>
+<command>ifdef</command>
+<arg choice="plain">
+<replaceable class="parameter">item</replaceable>
+</arg>
+<arg choice="plain">
+<replaceable class="parameter">"config-command [args]"</replaceable>
+</arg>
+</cmdsynopsis>
+</listitem>
+
 <listitem>
 <cmdsynopsis>
 <command><link linkend="ignore">ignore</link></command>
diff --git a/doc/muttrc.ifdef b/doc/muttrc.ifdef
new file mode 100644 (file)
index 0000000..f618d5d
--- /dev/null
@@ -0,0 +1,32 @@
+# Example Mutt config file for the 'ifdef' feature.
+
+# This feature introduces three useful commands which allow you to share
+# one config file between versions of Mutt that may have different
+# features compiled in.
+
+#      ifdef  symbol config-command [args...]
+#      ifndef symbol config-command [args...]
+#      finish                                
+
+# The 'ifdef' command tests whether Mutt understands the name of
+# a variable, function, command or compile-time symbol.
+# If it does, then it executes a config command.
+
+# The 'ifndef' command tests whether a symbol does NOT exist.
+
+# The 'finish' command tells Mutt to stop reading current config file.
+
+# If the 'trash' variable exists, set it.
+ifdef trash 'set trash=~/Mail/trash'
+
+# If the 'tag-pattern' function exists, bind a key to it.
+ifdef tag-pattern 'bind index <F6> tag-pattern'
+
+# If the 'imap-fetch-mail' command exists, read my IMAP config.
+ifdef imap-fetch-mail 'source ~/.mutt/imap.rc'
+
+# If the compile-time symbol 'USE_SIDEBAR' does not exist, then
+# stop reading the current config file.
+ifndef USE_SIDEBAR finish
+
+# vim: syntax=muttrc
diff --git a/doc/vimrc.ifdef b/doc/vimrc.ifdef
new file mode 100644 (file)
index 0000000..342c75e
--- /dev/null
@@ -0,0 +1,7 @@
+" Vim syntax file for the mutt ifdef patch
+
+syntax keyword muttrcCommand    ifdef
+syntax keyword muttrcCommand    ifndef
+syntax keyword muttrcCommand    finish
+
+" vim: syntax=vim