1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

16006: use styles for mail directory, pine directory, and muttrc.

This commit is contained in:
Clint Adams 2001-10-10 20:10:44 +00:00
parent 414f028ed9
commit 175ae571f3
3 changed files with 34 additions and 10 deletions

View file

@ -1,5 +1,9 @@
2001-10-10 Clint Adams <clint@zsh.org> 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: * 16005: Completion/Unix/Command/_mount:
check /etc/filesystems under Linux. check /etc/filesystems under Linux.

View file

@ -3,14 +3,15 @@
_mailboxes() { _mailboxes() {
#emulate -L zsh #emulate -L zsh
local expl ret=1 local expl ret=1
local pinedirectory="${pinedirectory:-~/mail}" local maildirectory pinedirectory
local maildirectory="${maildirectory:-~/Mail}" zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail"
zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory || pinedirectory="~/mail"
if (( ! $+_mailbox_cache )) then if (( ! $+_mailbox_cache )) then
_mailbox_cache "$@" _mailbox_cache "$@"
fi fi
case "${curcontext}" in case "${curcontext}:" in
(*:mail:*) (*:mail:*)
if [[ "$PREFIX" == +* ]]; then if [[ "$PREFIX" == +* ]]; then
_tags mailboxes _tags mailboxes
@ -49,7 +50,7 @@ _mailboxes() {
_requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0 _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0
if _requested files expl 'mailbox file'; then if _requested files expl 'mailbox file'; then
[[ "${curcontext}" != *:(mail|mush|mutt|zmail|zmlite):* ]] && [[ "${curcontext}:" != *:(mail|mush|mutt|zmail|zmlite):* ]] &&
compset -P -f compset -P -f
_files "$expl[@]" && ret=0 _files "$expl[@]" && ret=0
fi fi
@ -60,13 +61,15 @@ _mailboxes() {
} }
_mailbox_cache () { _mailbox_cache () {
# Depends on $maildirectory and $pinedirectory from _mailboxes! local i j _mc_tmp
local i j _mc_tmp muttrc="${muttrc:-~/.muttrc}"
local -aU dirboxes local -aU dirboxes
local maildirectory pinedirectory muttrc
typeset -aU -g _mailbox_cache typeset -aU -g _mailbox_cache
typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_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:-.} ]] && [[ -f ${~muttrc:-.} ]] &&
_mc_tmp=${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} && _mc_tmp=${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} &&
@ -98,13 +101,15 @@ _mailbox_cache () {
} }
_mua_mailboxes() { _mua_mailboxes() {
# Depends on $maildirectory and $pinedirectory from _mailboxes!
local -a mbox_short local -a mbox_short
local -aU mbox_names local -aU mbox_names
local ret=1 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 (*:elm:*) # I've probably got this wrong, or at least incomplete
mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" ) mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
mbox_short=( \! \< \> ) mbox_short=( \! \< \> )

View file

@ -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 style, and if successful will look in the directory under tt(~yousir) given
by the third argument to the style for possible completions. 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) kindex(match-original, completion style)
item(tt(match-original))( item(tt(match-original))(
This is used by the tt(_match) completer. If it is set to 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 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)'. 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) kindex(numbers, completion style)
item(tt(numbers))( item(tt(numbers))(
This is used with the tt(jobs) tag. If it is `true', the shell will 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 the style is not set but this file is found in one of various standard
locations it will be used as the default. 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) kindex(ports, completion style)
item(tt(ports))( item(tt(ports))(
A style holding the service names of ports to complete. If this is A style holding the service names of ports to complete. If this is