-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, December 12 at 07:30 AM, quoth Noah Sheppard: > 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>"
If I recall correctly, mutt's "magic" characters only work when they're the *first* character in the folder name. Think of them as behaving similar to the way that ~ behaves in the shell. > folder-hook . set my_curdir="^" That doesn't work because mutt doesn't consider random variable assignments as mailbox path names, and so doesn't attempt to expand mailbox path shortcuts in them. > That said, even when I run 'set my_curdir="^"' in mutt after muttrc > has been read, my_curdir is still empty. Really? When I do it, my_curdir becomes "^". Test it like this: set ?my_curdir Your macro has an additional problem: it wouldn't work even if my_curdir WAS correctly being set! You see, variable expansion is evaluated at the time the macro is established! To delay variable expansion until the macro is *triggered*, you'd have to escape the variable. For example, consider how this works: set my_archdir=/foo macro index,pager S "<save-message>$my_archdir<enter>" set my_archdir=/bar When you trigger the macro, where you you expect it to be saved? If you guessed "/foo", you'd be right, because variable expansion happened when the macro was established. If you want the variable to be re-interpreted every the macro is triggered, you'd have to do this: macro index,pager S "<save-message>\$my_archdir<enter>" > 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, That's because mutt expects $record will be a mailbox path name, and so expands mailbox path shortcut characters in it. However, things like $my_curdir are treated the same way variables like $signature are treated: as arbitrary strings. > If not, how does one get the current folder name in a variable which > can be used in various places? Well, technically, if you set $record to ^, you can use that. That's not exactly *convenient*, since $record has a primary function, I know that, but... As far as I know, there isn't a really *good* way to do what you're looking for (at the moment). ~Kyle - -- Education is the ability to listen to almost anything without losing your temper. -- Robert Frost -----BEGIN PGP SIGNATURE----- Comment: Thank you for using encryption! iEYEARECAAYFAklCgVgACgkQBkIOoMqOI14TywCgq1IqwdHwq8UdmwKrlNGPXRUo tIsAoMFwkHqzQ+YzFsebFxjG9FwB9IbZ =zv1S -----END PGP SIGNATURE-----