Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: PATCH: Improved _mailboxes



On Feb 21,  4:41pm, Bart Schaefer wrote:
} Subject: Re: PATCH: Improved _mailboxes
}
} The problem is that mutt uses _maildir_cache, pine uses _mbox_cache, and
} zmail uses _mh_cache.  (Actually now that I think about it, pine can use
} _mh_cache too.)

This patch adds mush and tkrat, and lets pine complete mh mailboxes.

There's one oddment left:  When completing the full paths added by
_multi_parts under menu completion, one gets things like

	zsh% mutt -f /<TAB>
	/home  /usr  /var
	zsh% mutt -f /<TAB>
	zsh% mutt -f /home/

Now hitting TAB just cycles /home /usr /var.  But if I type a / to continue
completing within /home, I get

	zsh% mutt -f /home//

I tried adding -S/ -q to the _multi_parts call but the slash still does not
become autoremovable.  It does vanish when I next type TAB:

	zsh% mutt -f /home//<TAB>
	zsh% mutt -f /home/schaefer/

This is with Sven's latest _multi_parts patch (9816).

Index: Completion/User/_mailboxes
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Completion/User/_mailboxes,v
retrieving revision 1.10
diff -u -r1.10 _mailboxes
--- _mailboxes	2000/02/21 16:30:58	1.10
+++ _mailboxes	2000/02/21 16:55:16
@@ -54,7 +54,7 @@
 # Files for pine must be absolute paths.
 
 if [[ "$PREFIX" != (|-f)+* &&
-      ( "${curcontext}" = *:(mail|zmail|zmlite):* ||
+      ( "${curcontext}" = *:(mail|mush|zmail|zmlite):* ||
         ( "${curcontext}" = *:pine:* && "$PREFIX" = (|-f)[/\~]* ) ) ]]; then
   _tags mailboxes files
 else
@@ -78,19 +78,35 @@
       if compset -P '+|-f+'; then
         mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
       else
-        mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}" "${_mailbox_cache[@]}" )
+        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_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[@]}" )
+      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

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



Messages sorted by: Reverse Date, Date, Thread, Author