zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Factor out calls to _multi_parts in _mailboxes
Date: Mon, 21 Feb 2000 10:57:38 +0000	[thread overview]
Message-ID: <1000221105738.ZM16693@candle.brasslantern.com> (raw)

I just noticed that all the case-branches except *:mh:* had the exact same
call to _multi_parts.  At one time they were mostly different, using the
literal array syntax; I changed that because it didn't work (before Sven's
recent patch) and then didn't notice that meant I could pull out all those
calls to do it once at the end.

Index: Completion/User/_mailboxes
===================================================================
@@ -28,7 +28,7 @@
     shift dirboxes
     if [[ -d "$i/cur" ]]; then
       _maildir_cache=( "${_maildir_cache[@]}" "$i" )
-    elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then
+    elif j=( $i/<1-> ) && [[ -n "$j" ]]; then
       _mh_cache=( "${_mh_cache[@]}" "$i" )
     else
       _mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) )
@@ -48,46 +48,41 @@
   local -U mbox_names
   case "${curcontext}" in
   (*:elm:*) # I've probably got this wrong, or at least incomplete
-    compadd "${expl[@]}" - \! \< \>
     mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
-    _multi_parts "${expl[@]}" / mbox_names;;
+    compadd "${expl[@]}" - \! \< \>;;
   (*:mail:*)
     if compset -P '+|-f+'; then
       mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
-      _multi_parts "${expl[@]}" / mbox_names
     else
       mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}" "${_mailbox_cache[@]}" )
-      _multi_parts "${expl[@]}" / mbox_names
       _path_files -J all-files
     fi;;
   (*:mh:*) # I've probably got this wrong, or at least incomplete
-    (( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache;;
+    (( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache
+    return;;
   (*:mutt:*)
     mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}" "${_maildir_cache[@]}" )
-    compadd "${expl[@]}" - \! \< \>
-    _multi_parts "${expl[@]}" / mbox_names;;
+    compadd "${expl[@]}" - \! \< \>;;
   (*: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[@]}" )
-    _multi_parts "${expl[@]}" / mbox_names
     # _path_files -J all-files -g '/*'
     ;;
   (*:(zmail|zmlite):*)
     if compset -P '+|-f+'; then
       mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
-      _multi_parts "${expl[@]}" / mbox_names
     else
-      compadd "${expl[@]}" - % \&
       mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
 		   "${_mailbox_cache[@]}" "${_mh_cache[@]}" )
-      _multi_parts "${expl[@]}" / mbox_names
+      compadd "${expl[@]}" - % \&
       _path_files -J all-files
     fi
     ;;
   (*) # Some other program wants mailbox names?  Use them all?
     mbox_names=( "${_mailbox_cache[@]}" "${_mbox_cache[@]}"
-		 "${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" )
-    _multi_parts "${expl[@]}" / mbox_names;;
+		 "${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" );;
   esac
+
+  (( $#mbox_names )) && _multi_parts "${expl[@]}" / mbox_names
 fi


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


                 reply	other threads:[~2000-02-21 10:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1000221105738.ZM16693@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --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).