Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _mailboxes



On Sep 20, 12:41pm, Clint Adams wrote:
> Subject: PATCH: _mailboxes
> Because [[ -f "${~muttrc}" ]] never returns true (the expansion does not
> occur when quoted), I changed it to test ${~muttrc} && [[ -f ${~muttrc} ]].

Oops.  I still think the extra "test" is wasteful ...

> Also, since the special folders ! < > are also used in elm, I added a
> check for a ~/.elm directory.  Perhaps it would be better to look for
> an .elmrc.  I can't think of a good way to do this.

Running "strings =mutt" on a machine where it's installed indicates that it
has some (undocumented?) support for a ~/.mutt/ directory as well.  So ...

Index: _mailboxes
===================================================================
@@ -12,7 +12,7 @@
 
 if (( ! $+_mailbox_cache )) then
 
-test ${~muttrc} && [[ -f ${~muttrc} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
+[[ -f ${~muttrc:-.} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
 
 mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
 dirboxes=( ${~maildirectory}/*(/) )
@@ -33,7 +33,7 @@
     fi
 done
 
-[[ -n "$muttboxes" ]] || [[ -d ~/.elm ]] &&
+[[ -n "$muttboxes" || -d ~/.elm || -d ~/.mutt ]] &&
     _mailbox_cache=(\! \< \> $muttboxes)
 [[ -n "$mailpath" ]] &&
     _mailbox_cache=($_mailbox_cache ${mailpath//\?*/})
  



Messages sorted by: Reverse Date, Date, Thread, Author