From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3698 invoked from network); 14 Feb 2000 11:56:47 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Feb 2000 11:56:47 -0000 Received: (qmail 19898 invoked by alias); 14 Feb 2000 11:56:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9719 Received: (qmail 19889 invoked from network); 14 Feb 2000 11:56:35 -0000 Date: Mon, 14 Feb 2000 12:56:23 +0100 (MET) Message-Id: <200002141156.MAA10295@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Fri, 11 Feb 2000 17:55:55 +0000 Subject: Re: completion but extra options allowed [ moved to zsh-workers ] Bart Schaefer wrote: > ... > > Yes, I noticed just after posting that this isn't actually handled by > _mutt and _mailboxes. In attempting to do something with this, I found > some rather strange things going on in the guts of the completion. > > _mutt calls _arguments in the expected way. > > _arguments calls "_description arguments expl mailbox" which sets expl > to (-J -default-). > > _arguments then calls "_mailboxes -J -default-" which (after setting up > the cache) calls "_wanted files expl 'mailbox specification'" which again > sets expl to (-J -default-). > > _mailboxes then calls "compadd -J -default- -J -default- - ..." which > seems a bit odd. The first -J -default- is from "$@" and the second is > of course "$expl[@]". Is that really doing the right thing? 1) Depending of the setting of the group-name style you may have gotten different names. 2) Yes, that's ok. The _description in _mailboxes sets up a default description that may be overridden by a calling function. 3) Depending on the implementors preferences, he may or may not change the '-f+:mailbox:_mailboxes' to '-f+:mailbox: _mailboxes', which will make _arguments *not* give a description to _mailboxes (i.e., then you only get the second one). In another message: > ... > > One thing that makes this difficult is that _path_files does not accept > the -i option of compadd, only the -P option. All completion I can think of are written so that they work nicely when PREFIX/IPREFIX (and SUFFIX/ISUFFIX) are set up appropriately. > However, even calling > > compadd -i + -f -W ~/Mail > > directly does not accomplish what I expected it to. Is this a bug, or am > I missing something? What IS the compadd equivalent of > > compctl -x 's[+] c[-1,-f],s[-f+]' -W ~/Mail -f ... -i just *adds* some string to IPREFIX. It is really only useful when used with -U, i.e. by functions that have to do all the matching themselves (because then IPREFIX isn't used by the completion code and -i can be used to tell it about an ignored prefix). 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 where the compset sets up PREFIX/IPREFIX for us. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de