about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-06-22 04:11:35 +0000
committerClint Adams <clint@users.sourceforge.net>2000-06-22 04:11:35 +0000
commit44b34667f844ce57b5b2eba0f2870c1ec7630348 (patch)
treef0182e773b6a048fa8d3386365f5f82d872f8550 /Completion/User
parente164618de256b765a191caa2cc0c2c6476f46abb (diff)
downloadzsh-44b34667f844ce57b5b2eba0f2870c1ec7630348.tar.gz
zsh-44b34667f844ce57b5b2eba0f2870c1ec7630348.tar.xz
zsh-44b34667f844ce57b5b2eba0f2870c1ec7630348.zip
12027: mutt smarts for _mailboxes
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/_mailboxes21
1 files changed, 17 insertions, 4 deletions
diff --git a/Completion/User/_mailboxes b/Completion/User/_mailboxes
index fb00719a3..8ee29007a 100644
--- a/Completion/User/_mailboxes
+++ b/Completion/User/_mailboxes
@@ -23,6 +23,12 @@ _mailboxes() {
       else
         _tags mailboxes files
       fi;;
+    (*:mutt:*)
+      if [[ "$PREFIX" == (|-f)[+=]* ]]; then
+	_tags mailboxes
+      else
+        _tags mailboxes files
+      fi;;
     (*:pine:*)
       # Files for pine must be absolute paths.
       if [[ "$PREFIX" == (|-f)[/\~]* ]]; then
@@ -43,7 +49,7 @@ _mailboxes() {
     _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0
 
     if _requested files expl 'mailbox file'; then
-      [[ "${curcontext}" != *:(mail|mush|zmail|zmlite):* ]] &&
+      [[ "${curcontext}" != *:(mail|mush|mutt|zmail|zmlite):* ]] &&
 	compset -P -f
       _files "$expl[@]" && ret=0
     fi
@@ -65,7 +71,7 @@ _mailbox_cache () {
 
 
   [[ -f ${~muttrc:-.} ]] &&
-    _mutt_cache=( ${${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} )
+    _mutt_cache=( ${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} )
 
 
   _mbox_cache=( ${~maildirectory}/*(^/) )
@@ -127,9 +133,16 @@ _mua_mailboxes() {
       fi
       ;;
     (*:mutt:*)
+      if compset -P '='; then
+        mbox_names=( "${_mutt_cache[@]#[+=]}" "${(@)_mbox_cache#$~maildirectory/}" "${(@)_maildir_cache#$~maildirectory/}" "${(@)_mh_cache#$~maildirectory/}")
+      elif compset -P +; then
+        mbox_names=( "${_mutt_cache[@]#[+=]}" "${(@)_mbox_cache#$~maildirectory/}" "${(@)_maildir_cache#$~maildirectory/}" "${(@)_mh_cache#$~maildirectory/}")
+      else
       mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}"
-		   "${_maildir_cache[@]}" )
-      mbox_short=( \! \< \> );;
+		   "${_maildir_cache[@]}" "${_mh_cache[@]}" )
+      mbox_short=( \! \< \> )
+      fi
+      ;;
     (*:pine:*)
       # Pine is like mail but with no leading `+' to disambiguate;
       # any files not in $pinedirectory must be absolute paths.