zsh-workers
 help / color / mirror / code / Atom feed
* Re: completion but extra options allowed
@ 2000-02-14 11:56 Sven Wischnowsky
       [not found] ` <20000210153411.A27005@fruitcom.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-02-14 11:56 UTC (permalink / raw)
  To: zsh-workers


[ 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Completion for mutt
@ 2000-02-14 15:11           ` Ollivier Robert
  2000-02-14 17:21             ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Ollivier Robert @ 2000-02-14 15:11 UTC (permalink / raw)
  To: zsh-workers

When we switched from compctl to completion widgets, we lost something in
the Mutt frompltion. I used to be able to complete on '+' (which represents
~/Mail generally) after a '-f'. Now it is trying to expand only full path
behind "-f"...

The old compctl rule is the following:

compctl -u -x 's[-]' -k '(a c f F i n p s v z h)' - 's[+]' -W $HOME/Mail -f - 'S[[./]]' -f - 'c[-1,-s]' -X '<subject>' - 'c[-1,-i]' -f - 'c[-1,-F]' -f - 'c[-1,-a]' -f - 'c[-1,-f]' -f -- mutt

Also this one doesn't seem to work anymore...

compctl -g '/var/db/pkg/*(/:t)' pkg_delete pkg_info
-- 
Ollivier ROBERT -=- Eurocontrol EEC/TEC -=- roberto@eurocontrol.fr
The Postman hits! The Postman hits! You have new mail.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Completion for mutt
  2000-02-14 15:11           ` Completion for mutt Ollivier Robert
@ 2000-02-14 17:21             ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-02-14 17:21 UTC (permalink / raw)
  To: Andy Spiegl, Ollivier Robert, Sven Wischnowsky, zsh-workers

On Feb 14, 12:56pm, Sven Wischnowsky wrote:
} Subject: Re: completion but extra options allowed
} 
} [ moved to zsh-workers ]
} 
} Bart Schaefer wrote:
} 
} > _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?
} 
} 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).

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.

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 ...

} In another message:
} 
} > compadd -i + -f -W ~/Mail
} > 
} > directly does not accomplish what I expected it to.  Is this a bug, or am
} > I missing something?
} 
} -i just *adds* some string to IPREFIX. It is really only useful when
} used with -U

Ah, of course.

} > 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.)

On Feb 14,  3:00pm, Andy Spiegl wrote:
} Subject: Re: completion but extra options allowed
}
} > } And it doesn't expand local filenames either:
} > } eule:~>cd Mail
} > } eule:~/Mail>mutt -f a<TAB>
} > 
} > I think that's intentional on the grounds that files not in the mail
} > directory are not likely to be mail files.  It should probably be set
} > by a style, if the 'mailbox' style won't already work.
} I wasn't able to find anything about the mailbox-style in the docs.  :-(
} What can I set with it?

My mistake, there isn't any mailbox style.  There probably should be,
implemented by _mailboxes.

} > You don't need to edit _mailboxes, you just need
} > 	set muttrc=~/.mutt/local
} But of course that doesn't work for the aliases, which are in ~/.mutt/aliases.
} Hm, while just looking at _mutt I see that mailaddresses are taken from
} 'recipient:->userhost', which I don't understand.  Where is that info
} being set?  Or in other words: how can I influence the list of addressees?

The ->userhost means that it will call the _users completer until the
current word contains an @, and then it will call the _hosts completer.
The _users completer reads the list of user names from the *:users style,
and the _hosts completer does the same for the *:hosts style.

_mutt is currently not clever about completing mail aliases.

On Feb 14,  4:11pm, Ollivier Robert wrote:
} Subject: Completion for mutt
}
} When we switched from compctl to completion widgets, we lost something in
} the Mutt frompltion. I used to be able to complete on '+' (which represents
} ~/Mail generally) after a '-f'. Now it is trying to expand only full path
} behind "-f"...

The _mailboxes completion function is very rudimentary at this point.
It tries to understand spool files, maildir boxes, MH folders, pine
mail files, and mutt mail files, but it throws them all together into
the same big cache of mailbox names and then supplies those as the
completions.  They really should be broken out by context (i.e. it's
no use completing maildirs for pine, it won't read them), put into
different completion groups, etc.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Completion for mutt
  2000-02-15  9:53 Sven Wischnowsky
@ 2000-02-15 11:49 ` Ollivier Robert
  0 siblings, 0 replies; 5+ messages in thread
From: Ollivier Robert @ 2000-02-15 11:49 UTC (permalink / raw)
  To: zsh-workers

According to Sven Wischnowsky:
> If you want to say that exactly that compctl doesn't work for you --
> it does for me (well, something similar, I don't have a Debian system
> here).

It is a FreeBSD system but no matter.
 
> If you want to say that it doesn't complete the right thing after
> loading the new completion system -- right, there doesn't seem to be a 
> completion function for these commands.

I thought the new completion was compatible with the old one (i.e. having
compctl would still work).
 
> If you want to say that after loading the new completion system the
> compctl doesn't seem to be used -- right, see the function _default
> in the Base subdirectory of the distribution. You can un-comment a
> call to `compcall' there to make compctl's be used when there is no
> completion function for a certain command.

I have uncommented this line but the old mutt completion rule still doesn't
work.

Now, I just found that what I used to make completion case-independent (see
below) doesn't work anymore. With dev-16 it was still working.

compctl -M 'm:{a-z}={A-Z} m:{A-Z}={a-z}'

Now, I can't complete independantly of the case :-(
-- 
Ollivier ROBERT -=- Eurocontrol EEC/TEC -=- roberto@eurocontrol.fr
The Postman hits! The Postman hits! You have new mail.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Completion for mutt
@ 2000-02-15  9:53 Sven Wischnowsky
  2000-02-15 11:49 ` Ollivier Robert
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-02-15  9:53 UTC (permalink / raw)
  To: zsh-workers


Ollivier Robert wrote:

> ...
> 
> Also this one doesn't seem to work anymore...
> 
> compctl -g '/var/db/pkg/*(/:t)' pkg_delete pkg_info

I'm not sure what you mean... 

If you want to say that exactly that compctl doesn't work for you --
it does for me (well, something similar, I don't have a Debian system
here).

If you want to say that it doesn't complete the right thing after
loading the new completion system -- right, there doesn't seem to be a 
completion function for these commands.

If you want to say that after loading the new completion system the
compctl doesn't seem to be used -- right, see the function _default
in the Base subdirectory of the distribution. You can un-comment a
call to `compcall' there to make compctl's be used when there is no
completion function for a certain command.


Or maybe you meant something completely different...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-02-15 11:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-14 11:56 completion but extra options allowed Sven Wischnowsky
     [not found] ` <20000210153411.A27005@fruitcom.com>
     [not found]   ` <1000210175857.ZM6927@candle.brasslantern.com>
     [not found]     ` <20000210195143.A26109@br-online.de>
     [not found]       ` <1000211175555.ZM32309@candle.brasslantern.com>
     [not found]         ` <20000214150010.B17427@br-online.de>
2000-02-14 15:11           ` Completion for mutt Ollivier Robert
2000-02-14 17:21             ` Bart Schaefer
2000-02-15  9:53 Sven Wischnowsky
2000-02-15 11:49 ` Ollivier Robert

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).