From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Improved _mailboxes
Date: Mon, 21 Feb 2000 20:06:22 +0000 [thread overview]
Message-ID: <E12Mz2L-0006R9-00.2000-02-21-20-02-29@cmailg6.svr.pol.co.uk> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Mon, 21 Feb 2000 16:41:01 GMT." <1000221164101.ZM21266@candle.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
"Bart Schaefer" wrote:
> } Oh, and I could not apply 9812 and 9815 automatically, I hope this
> } patch here applies without problems. Dunno how that happened.
>
> That could be my trouble, as I was playing with _mailboxes before. Did
> anyone else have a problem? I can re-diff against -dev-19 if needed.
I had this problem, and in fact with Sven's patch although that's probably
due to indifferent success at applying the previousones by hand, something
I've never been good at since it requires patience. The last patch applied
OK, however. Here's _mailbox as I currently have it to check, and if
correct to install for other people with problems.
I've attached it, so that it comes out right. What's the correct
Content-Type? I've left it as text/plain since it's not actually supposed
to be run. I don't know the etiquette on such matters.
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
[-- Attachment #2: Completion/User/_mailboxes --]
[-- Type: text/plain, Size: 4021 bytes --]
#autoload
#emulate -L zsh
setopt localoptions nullglob
# This is still needlessly mutt-biased and should be fixed.
local -U dirboxes
local i j expl muttrc="${muttrc:-~/.muttrc}" files nm="$compstate[nmatches]"
local pinedirectory="${pinedirectory:-~/mail}"
local maildirectory="${maildirectory:-~/Mail}"
if (( ! $+_mailbox_cache )) then
typeset -U -g _mailbox_cache
typeset -U -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache
_mailbox_cache=()
_mbox_cache=()
_maildir_cache=()
_mh_cache=()
_mutt_cache=()
_pine_cache=()
[[ -f ${~muttrc:-.} ]] &&
_mutt_cache=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
_mbox_cache=( ${~maildirectory}/*(^/) )
_pine_cache=( ${~pinedirectory}/**/*(.) )
dirboxes=( ${~maildirectory}/*(/) )
while (( $#dirboxes )); do
i=${dirboxes[1]}
shift dirboxes
if [[ -d "$i/cur" ]]; then
_maildir_cache=( "${_maildir_cache[@]}" "$i" )
elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then
_mh_cache=( "${_mh_cache[@]}" "$i" )
else
_mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) )
dirboxes=( $dirboxes $i/*(/) )
fi
done
[[ -n "$_mutt_cache" || -d ~/.elm || -d ~/.mutt ]] &&
_mailbox_cache=( \! \< \> )
[[ -n "$mailpath" ]] &&
_mailbox_cache=( "${_mailbox_cache[@]}" "${(@)mailpath%%\?*}" )
[[ -n "$MAIL" ]] && _mailbox_cache=( "${_mailbox_cache[@]}" $MAIL )
fi
# Files for pine must be absolute paths.
if [[ "$PREFIX" != (|-f)+* &&
( "${curcontext}" = *:(mail|mush|zmail|zmlite):* ||
( "${curcontext}" = *:pine:* && "$PREFIX" = (|-f)[/\~]* ) ) ]]; then
_tags mailboxes files
else
_tags mailboxes
fi
while _tags; do
if _requested mailboxes expl 'mailbox specification'; then
local mbox_short
local -U mbox_names
mbox_short=()
mbox_names=()
case "${curcontext}" in
(*:elm:*) # I've probably got this wrong, or at least incomplete
mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
mbox_short=( \! \< \> )
;;
(*:mail:*)
if compset -P '+|-f+'; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" )
fi
;;
(*:mh:*) # I've probably got this wrong, or at least incomplete
(( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache
;;
(*:mush:*)
if compset -P '+|-f+'; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" )
mbox_short=( % \& )
fi
;;
(*:mutt:*)
mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}"
"${_maildir_cache[@]}" )
mbox_short=( \! \< \> );;
(*:pine:*)
# Pine is like mail but with no leading `+' to disambiguate;
# any files not in $pinedirectory must be absolute paths.
mbox_names=( "${(@)_pine_cache#$~pinedirectory/}" "${_mbox_cache[@]}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
;;
(*:tkrat:*) # Has a couple of custom formats I haven't programmed for.
mbox_names=( "${_mbox_cache[@]}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
;;
(*:(zmail|zmlite):*)
if compset -P '+|-f+'; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
mbox_short=( % \& )
fi
;;
(*) # Some other program wants mailbox names? Use them all?
mbox_names=( "${_mailbox_cache[@]}" "${_mbox_cache[@]}"
"${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" )
;;
esac
(( $#mbox_names )) && _multi_parts "${expl[@]}" / mbox_names
(( $#mbox_short )) && compadd "$expl[@]" - "$mbox_short[@]"
fi
if _requested files expl 'mailbox file'; then
compset -P -f
_path_files "$expl[@]"
fi
[[ nm -ne $compstate[nmatches] ]] && return 0
done
return 1
next prev parent reply other threads:[~2000-02-21 20:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-21 12:30 Sven Wischnowsky
2000-02-21 16:41 ` Bart Schaefer
2000-02-21 17:25 ` PATCH: " Bart Schaefer
2000-02-21 20:06 ` Peter Stephenson [this message]
2000-02-21 21:59 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
2000-02-22 8:52 Sven Wischnowsky
2000-02-22 17:55 ` Peter Stephenson
2000-02-21 10:34 Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E12Mz2L-0006R9-00.2000-02-21-20-02-29@cmailg6.svr.pol.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).