blob: 06906628ec59daacb4129172c12dab5cd2fda4fe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#autoload
emulate -L zsh
setopt nullglob
# This is still needlessly mutt-biased and should be fixed.
local -U muttboxes mboxes dirboxes MHboxes maildirboxes
local i j expl muttrc="${muttrc:-~/.muttrc}"
local pinedirectory="${pinedirectory:-~/mail}"
local maildirectory="${maildirectory:-~/Mail}"
if (( ! $+_mailbox_cache )) then
[[ -f ${~muttrc:-.} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
dirboxes=( ${~maildirectory}/*(/) )
while (( $#dirboxes ))
do
i=$dirboxes[1]
shift dirboxes
if [[ -d "$i/cur" ]]
then
maildirboxes=( $maildirboxes $i )
elif j=( $i/<1-> ) && [[ -n "$j" ]]
then
MHboxes=( $MHboxes $i )
else
mboxes=( $mboxes $i/*(.) )
dirboxes=( $dirboxes $i/*(/) )
fi
done
[[ -n "$muttboxes" || -d ~/.elm || -d ~/.mutt ]] &&
_mailbox_cache=(\! \< \> $muttboxes)
[[ -n "$mailpath" ]] &&
_mailbox_cache=($_mailbox_cache ${mailpath//\?*/})
_mailbox_cache=($_mailbox_cache $mboxes $maildirboxes $MHboxes)
fi
_description expl 'mailbox specification'
compadd "$@" "$expl[@]" - "$_mailbox_cache[@]"
|