about summary refs log tree commit diff
path: root/Completion/User/_mailboxes
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-15 22:44:07 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-15 22:44:07 +0000
commit5de49e6fe89ed6808d4e4fa78beca9e97f168651 (patch)
tree6d5052ab63b45ce438d04be10ab1e8da32a845ee /Completion/User/_mailboxes
parent1595df61e6dffabda3b602344a12bf0792189ed4 (diff)
downloadzsh-5de49e6fe89ed6808d4e4fa78beca9e97f168651.tar.gz
zsh-5de49e6fe89ed6808d4e4fa78beca9e97f168651.tar.xz
zsh-5de49e6fe89ed6808d4e4fa78beca9e97f168651.zip
Initial revision
Diffstat (limited to 'Completion/User/_mailboxes')
-rw-r--r--Completion/User/_mailboxes32
1 files changed, 32 insertions, 0 deletions
diff --git a/Completion/User/_mailboxes b/Completion/User/_mailboxes
new file mode 100644
index 000000000..c49aa8185
--- /dev/null
+++ b/Completion/User/_mailboxes
@@ -0,0 +1,32 @@
+#autoload
+
+# This is needlessly mutt-biased and should be fixed.
+
+local expl muttboxes mboxes dirboxes MHboxes maildirboxes muttrc="~/.muttrc" maildirectory="~/Mail"
+
+test -f "$compconfig[muttrc_path]" && muttrc=$compconfig[muttrc_path]
+test -f "$compconfig[maildirectory]" && maildirectory=$compconfig[maildirectory]
+
+if (( ! $+_mailbox_cache )) then
+
+test ${muttrc} || test -f ${~muttrc} && muttboxes=( ${(@)$(grep mailboxes ${~muttrc})[2,-1]} )
+
+mboxes=(${~maildirectory}/*(^/))
+dirboxes=(${~maildirectory}/*(/))
+
+for i in $dirboxes
+do 
+if test -d "${i}/cur"
+then
+maildirboxes=($maildirboxes $i)
+else
+MHboxes=($MHboxes $i)
+fi
+done
+
+_mailbox_cache=(\! \< \> $muttboxes $mboxes $maildirboxes $MHboxes)
+
+fi
+
+_description expl 'mailbox specification'
+compadd "$@" "$expl[@]" - "$_mailbox_cache[@]"