about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/User/_mailboxes7
1 files changed, 5 insertions, 2 deletions
diff --git a/Completion/User/_mailboxes b/Completion/User/_mailboxes
index 08dbec816..eee6c6f35 100644
--- a/Completion/User/_mailboxes
+++ b/Completion/User/_mailboxes
@@ -12,7 +12,7 @@ local maildirectory="${maildirectory:-~/Mail}"
 
 if (( ! $+_mailbox_cache )) then
 
-[[ -f "${~muttrc}" ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
+test ${~muttrc} && [[ -f ${~muttrc} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
 
 mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
 dirboxes=( ${~maildirectory}/*(/) )
@@ -33,8 +33,11 @@ do
     fi
 done
 
-[[ -n "$muttboxes" ]] &&
+[[ -n "$muttboxes" ]] || [[ -d ~/.elm ]] &&
     _mailbox_cache=(\! \< \> $muttboxes)
+[[ -n "$mailpath" ]] &&
+    _mailbox_cache=($_mailbox_cache ${mailpath//\?*/})
+
 _mailbox_cache=($_mailbox_cache $mboxes $maildirboxes $MHboxes)
 
 fi