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
commit20c9bfe78dae52569f241752306a2494f5624f63 (patch)
treeb48005de882af8c7a015dbafa530dedbf5e760a7 /Completion/User/_mailboxes
parente89eda2635dc338b5639c0bac9452189ecf9b730 (diff)
downloadzsh-20c9bfe78dae52569f241752306a2494f5624f63.tar.gz
zsh-20c9bfe78dae52569f241752306a2494f5624f63.tar.xz
zsh-20c9bfe78dae52569f241752306a2494f5624f63.zip
manual/7860
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[@]"