From 45df60b1cbc59b472186cf6a3f2ddd3b37249dcb Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Fri, 14 Jul 2006 00:01:16 +0000 Subject: [PATCH] Document $my_ variables and add a section about how to calculate the header cache file name for a given folder. Modified for clarity. --- doc/manual.xml.head | 157 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 145 insertions(+), 12 deletions(-) diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 206960c7..f95e751b 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -1356,14 +1356,26 @@ the first line of output from the Unix command will be substituted. -UNIX environments can be accessed like the way it is done in shells like -sh and bash: Prepend the name of the environment by a ``$''. For -example, +Both environment variables and mutt variables can be accessed by +prepending ``$'' to the name of the variable. For example, + set record=+sent_on_$HOSTNAME + +will cause mutt to save outgoing messages to a folder named +``sent_on_kremvax'' if the environment variable HOSTNAME is set to +``kremvax.'' (See $record for +details.) + + + +Mutt expands the variable when it is assigned, not when it is used. If +the value of a variable on the right-hand side of an assignment +changes after the assignment, the variable on the left-hand side will +not be affected. @@ -2808,7 +2820,14 @@ spam "^From: .*MAILER-DAEMON" "999" -Setting variables +Setting and Querying Variables + + +Commands + + +The following commands are available to manipulate and query variables: + @@ -2894,6 +2913,107 @@ With the reset command there exists the special variable ``al which allows you to reset all variables to their system defaults. + + + +User-defined variables + + +Introduction + + +Along with the variables listed in the +Configuration variables section, mutt +supports user-defined variables with names starting +with my_ as in, for +example, my_cfgdir. + + + +The set command creates a +custom $my_ variable and changes its +value. The unset and reset +commands remove the variable entirely. + + + +Since user-defined variables are expanded in the same way that +environment variables are (except for +the shell-escape command), this +feature can be used to make configuration files more readable. + + + + + +Examples + + +The following example defines and uses the variable my_cfgdir +to abbreviate the calls of the source command: + + + + +set my_cfgdir = $HOME/mutt/config + +source $my_cfgdir/hooks +source $my_cfgdir/macros +# more source commands... + + + + +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 +$delete is changed temporarily +while its original value is saved as my_delete. +After the macro has executed all commands, the original value of $delete is restored. + + + + +macro pager , x '\ +<enter-command>set my_delete=$delete<enter>\ +<enter-command>set delete=yes<enter>\ +...\ +<enter-command>set delete=$my_delete<enter>' + + + + +Since mutt expands such values already when parsing the configuration +file(s), the value of $my_delete in the +last example would be the value of $delete exactly +as it was at that point during parsing the configuration file. If +another statement would change the value for $delete +later in the same or another file, it would have no effect on +$my_delete. However, the expansion can +be deferred to runtime, as shown in the next example, when escaping the +dollar sign. + + + + +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 ; unset my_old_pager_stop<Enter>" + + + + +Note that there is a space +between <enter-command> and +the set configuration command, preventing mutt from +recording the macro's commands into its history. + + + + + + @@ -4500,7 +4620,7 @@ following types of folders: IMAP, POP, Maildir and MH. Header caching greatly improves speed because for remote folders, headers usually only need to be downloaded once. For Maildir and MH, reading the headers from a single file is much faster than looking at possibly -thousands of single files (since Maildir uses one file per message.) +thousands of single files (since Maildir and MH use one file per message.) @@ -4520,10 +4640,23 @@ to a directory. -For the one-file-per-folder case, database files will be named by -MD5 sums and can be removed if a system is short on space. However, -there currently is no easy to find out which database file is used -for which folder. +For the one-file-per-folder case, database files will be named by MD5 +sums. They may be safely removed if a system is short on space. You +can compute the name of the header cache file for a particular folder +through a command like the following: + + + + +$ printf '%s' '/path/to/folder' | md5sum +$ printf '%s' 'imaps://user@host/path/to/folder' | md5sum +$ printf '%s' 'pops://user@host' | md5sum + + + + +The md5sum command may also be +named md5, depending on your operating system. @@ -4907,7 +5040,7 @@ since it is not itself subject to any further expansion): -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 @@ -5063,7 +5196,7 @@ print command: image/*; xv %s -image/gif; ; print= anytopnm %s | pnmtops | lpr; \ +image/gif; ; print= anytopnm %s | pnmtops | lpr; \ nametemplate=%s.gif @@ -5214,7 +5347,7 @@ image/jpeg;xv %s; x-mozilla-flags=internal # 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 -- 2.40.0