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

use current folder name as argument to abitrary command



Esteemed mutt users,

I would like to be able to use the current folder name as an argument to 
arbitrary commands.  I've read various wikis and forum postings about how "^" 
can be used in certain contexts (like setting record) to give the current 
folder name (as of 1.5.10 I believe), but this has not worked in the commands 
I'm trying to do.

I'm using this to set up some mail archiving. Here's what I tried first:

set my_archdir="/mnt/data/storage/mail/boxes" #the path to the directory which 
will contain my archive dirs
macro index,pager S "<save-message>$my_archdir/^<enter>"

This did not work (it treats the "^" literally), which doesn't particularly 
surprise me since "^" looks more like a magic symbol than a real variable. The 
next thing I tried was putting the current directory in a variable as a 
folder-hook, which also did not work:

folder-hook . set my_curdir="^"
macro index,pager S "<save-message>$my_archdir/$my_curdir<enter>"

The error mutt gives (/mnt/data/storage/mail/boxes is not a mail box) indicates 
that my_curdir is empty.  Does the "^" get replaced with the blank string when 
muttrc is first read and there is no "current" mailbox?  I would have expected 
the set command to be reevaluated each time I switch into a new folder. That 
said, even when I run 'set my_curdir="^"' in mutt after muttrc has been read, 
my_curdir is still empty.  If 'set record="^"' works to get the current folder 
name, why doesn't it work to put the current folder name in a user variable, or 
am I making a stupid mistake?  If not, how does one get the current folder name 
in a variable which can be used in various places?

Mutt version information:

Mutt 1.5.16 (2007-06-09)
Copyright (C) 1996-2007 Michael R. Elkins and others.
Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
Mutt is free software, and you are welcome to redistribute it
under certain conditions; type `mutt -vv' for details.

System: Linux 2.6.26-gentoo-r4 (i686)
ncurses: ncurses 5.6.20061217 (compiled with 5.6)
Compile options:
-DOMAIN
-DEBUG
+HOMESPOOL  -USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE  
-USE_FCNTL  +USE_FLOCK   -USE_INODESORT   
-USE_POP  -USE_IMAP  -USE_SMTP  -USE_GSS  -USE_SSL_OPENSSL  -USE_SSL_GNUTLS  
-USE_SASL  -HAVE_GETADDRINFO  
-HAVE_REGCOMP  +USE_GNU_REGEX  
+HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET  
+HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM  
-CRYPT_BACKEND_CLASSIC_PGP  -CRYPT_BACKEND_CLASSIC_SMIME  -CRYPT_BACKEND_GPGME  
-EXACT_ADDRESS  -SUN_ATTACHMENT  
+ENABLE_NLS  -LOCALES_HACK  +HAVE_WC_FUNCS  +HAVE_LANGINFO_CODESET  
+HAVE_LANGINFO_YESEXPR  
+HAVE_ICONV  -ICONV_NONTRANS  -HAVE_LIBIDN  +HAVE_GETSID  +USE_HCACHE  
-ISPELL
SENDMAIL="/usr/sbin/sendmail"
MAILPATH="Maildir"
PKGDATADIR="/usr/share/mutt"
SYSCONFDIR="/etc/mutt"
EXECSHELL="/bin/sh"
MIXMASTER="mixmaster"
To contact the developers, please mail to <mutt-dev@xxxxxxxx>.
To report a bug, please visit http://bugs.mutt.org/.

patch-1.5.16.sidebar.20070704.txt

Thanks much,
-- 
Noah Sheppard
Assistant Computer Resource Manager
Taylor University CSE Department
nsheppar@xxxxxxxxxxxxxx