about summary refs log tree commit diff
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
parent414f028ed998a0e3f8666bb4bb763104cd4a0b91 (diff)
downloadzsh-175ae571f38bb7f18125261b76c8e27074363bba.tar.gz
zsh-175ae571f38bb7f18125261b76c8e27074363bba.tar.xz
zsh-175ae571f38bb7f18125261b76c8e27074363bba.zip
16006: use styles for mail directory, pine directory, and muttrc.
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Type/_mailboxes25
-rw-r--r--Doc/Zsh/compsys.yo15
3 files changed, 34 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index bdf29a700..0fbaf6ad1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2001-10-10  Clint Adams  <clint@zsh.org>
 
+	* 16006: Completion/Unix/Type/_mailboxes, Doc/Zsh/compsys.yo:
+	use styles for mail directory, pine directory,
+	and muttrc.
+
 	* 16005: Completion/Unix/Command/_mount:
 	check /etc/filesystems under Linux.
 
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=( \! \< \> )
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index ff41b09b3..8c8bd96c3 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1590,6 +1590,11 @@ attempt to match the name `tt(toast)' against the first argument to the
 style, and if successful will look in the directory under tt(~yousir) given
 by the third argument to the style for possible completions.
 )
+kindex(mail-directory, completion style)
+item(tt(mail-directory))(
+If set, zsh will assume that mailbox files can be found in
+the directory specified.  It defaults to `tt(~/Mail)'.
+)
 kindex(match-original, completion style)
 item(tt(match-original))(
 This is used by the tt(_match) completer.  If it is set to
@@ -1740,6 +1745,11 @@ matches is generated em(or) the list of matches does not fit onto the
 screen, both of `tt(yes=)' and `tt(select=)' can be given twice, once
 with a number and once with `tt(long)' or `tt(long-list)'.
 )
+kindex(muttrc, completion style)
+item(tt(muttrc))(
+If set, zsh will assume that the local mutt configuration can be found
+in the file specified.  It defaults to `tt(~/.muttrc)'.
+)
 kindex(numbers, completion style)
 item(tt(numbers))(
 This is used with the tt(jobs) tag.  If it is `true', the shell will
@@ -1835,6 +1845,11 @@ containing color names in the format of an X11 tt(rgb.txt) file.  If
 the style is not set but this file is found in one of various standard
 locations it will be used as the default.
 )
+kindex(pine-directory, completion style)
+item(tt(pine-directory))(
+If set, zsh will assume that PINE mailbox files can be found in
+the directory specified.  It defaults to `tt(~/mail)'.
+)
 kindex(ports, completion style)
 item(tt(ports))(
 A style holding the service names of ports to complete.  If this is