about summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-10-10 20:10:44 +0000
committerClint Adams <clint@users.sourceforge.net>2001-10-10 20:10:44 +0000
commit175ae571f38bb7f18125261b76c8e27074363bba (patch)
treeff726d2434ae5e8964eb8ccad69c98182fda1596 /Completion/Unix
parent414f028ed998a0e3f8666bb4bb763104cd4a0b91 (diff)
downloadzsh-175ae571f38bb7f18125261b76c8e27074363bba.tar.gz
zsh-175ae571f38bb7f18125261b76c8e27074363bba.tar.xz
zsh-175ae571f38bb7f18125261b76c8e27074363bba.zip
16006: use styles for mail directory, pine directory, and muttrc.
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Type/_mailboxes25
1 files changed, 15 insertions, 10 deletions
diff --git a/Completion/Unix/Type/_mailboxes b/Completion/Unix/Type/_mailboxes
index 53f452ce5..d3c60790d 100644
--- a/Completion/Unix/Type/_mailboxes
+++ b/Completion/Unix/Type/_mailboxes
@@ -3,14 +3,15 @@
 _mailboxes() {
   #emulate -L zsh
   local expl ret=1
-  local pinedirectory="${pinedirectory:-~/mail}"
-  local maildirectory="${maildirectory:-~/Mail}"
+  local maildirectory pinedirectory
+  zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail"
+  zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory || pinedirectory="~/mail"
 
   if (( ! $+_mailbox_cache )) then
     _mailbox_cache "$@"
   fi
 
-  case "${curcontext}" in
+  case "${curcontext}:" in
     (*:mail:*)
       if [[ "$PREFIX" == +* ]]; then
 	_tags mailboxes
@@ -49,7 +50,7 @@ _mailboxes() {
     _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0
 
     if _requested files expl 'mailbox file'; then
-      [[ "${curcontext}" != *:(mail|mush|mutt|zmail|zmlite):* ]] &&
+      [[ "${curcontext}:" != *:(mail|mush|mutt|zmail|zmlite):* ]] &&
 	compset -P -f
       _files "$expl[@]" && ret=0
     fi
@@ -60,13 +61,15 @@ _mailboxes() {
 }
 
 _mailbox_cache () {
-  # Depends on $maildirectory and $pinedirectory from _mailboxes!
-
-  local i j _mc_tmp muttrc="${muttrc:-~/.muttrc}"
+  local i j _mc_tmp
   local -aU dirboxes
+  local maildirectory pinedirectory muttrc
   typeset -aU -g _mailbox_cache
   typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache
 
+  zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail"
+  zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory || pinedirectory="~/mail"
+  zstyle -s ":completion:${curcontext}:" muttrc muttrc || muttrc="~/.muttrc"
 
   [[ -f ${~muttrc:-.} ]] &&
     _mc_tmp=${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} &&
@@ -98,13 +101,15 @@ _mailbox_cache () {
 }
 
 _mua_mailboxes() {
-  # Depends on $maildirectory and $pinedirectory from _mailboxes!
-
   local -a mbox_short
   local -aU mbox_names
   local ret=1
 
-  case "${curcontext}" in
+  local maildirectory pinedirectory
+  zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail"
+  zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory || pinedirectory="~/mail"
+
+  case "${curcontext}:" in
     (*:elm:*) # I've probably got this wrong, or at least incomplete
       mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
       mbox_short=( \! \< \> )