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

Re: Completion for mutt (with PATCH)



Bart Schaefer wrote:

> I guess the question is not whether it's right for _mutt to pass the
> first -J to _mailboxes, but whether it's right for _mailboxes to pass
> both -J along to compadd, given that it doesn't generate anything that
> will ever be put in the first group.

Remember: for most options, compadd uses the first occurrence if they
are given more than once (the exception is -M -- all of them are
used).

In other words: the arguments given to _mailboxes override the
defaults it builds itself.

> On the other hand, _mailboxes doesn't know what else may be in "$@" so
> it can't just ignore it entirely ... or can it?  _files appears to ...

Not really. _files parses its arguments and takes all interesting
options to give it to _path_files. Some time ago it just did the same
as _mailboxes, but with the appearence of tags _files had to learn to
modify or ignore some of the things it got (e.g. a -g option).

> ...
> 
> } > What IS the compadd equivalent of 
> } > compctl -x 's[+] c[-1,-f],s[-f+]' -W ~/Mail -f ...
> } 
> } So, the right way to do the same as that compctl would be:
> } 
> }   if compset -P '+|-f+' || [[ $words[CURRENT-1] = -f ]]; then
> }     _files -W ~/Mail
> }   else
> }     ...
> }   fi
> 
> OK ... now a slightly different question:  In _mailboxes, we already
> have a list of all the mailboxes in ~/Mail.  How do I get the equivalent
> of "_files -W ~/Mail" with that already-generated list as the starting
> point?  (Because ~/Mail may contain maildir or MH directories, it's
> not sufficient to simply complete files as _files does.)

First, I would get rid of the (expansion of) ~/Mail at the beginning
of all the strings in the cache. And then just use _multi_parts like
_tar does. (I haven't really looked at how the cache looks like
because I use a self-written mail reader, but I guess it just contains 
filenames and stuff, right?)


Some doc fixes.

Bye
 Sven

diff -ru ../z.old/Doc/Zsh/compwid.yo Doc/Zsh/compwid.yo
--- ../z.old/Doc/Zsh/compwid.yo	Tue Feb 15 10:04:06 2000
+++ Doc/Zsh/compwid.yo	Tue Feb 15 10:25:04 2000
@@ -548,7 +548,7 @@
 item(tt(-M) var(match-spec))(
 This gives local match specifications as described below in
 noderef(Matching Control). This option may be given more than once. In 
-this case all var(match-spec)s given are contaneted with speces
+this case all var(match-spec)s given are concatenated with spaces
 between them to form the specification string to use.
 Note that they will only be used if the tt(-U) option is not given.
 )
@@ -589,6 +589,9 @@
 hyphens.
 )
 enditem()
+
+Except for the tt(-M) flag, if any of these flags is given more than
+once, the first one (and its argument) will be used.
 )
 findex(compset)
 cindex(completion widgets, modifying special parameters)

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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