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

Re: How to complete backquote, etc. using compsys?



Bart Schaefer wrote:
> 
> } how can it tell it's in $(...)?
> 
> Hmm, at the moment perhaps it doesn't, but it could look at $LBUFFER to
> find out.

Parsing $LBUFFER correctly to avoid any quoted $( and matching the
closing brackets wouldn't be easy. No doubt, the C code already has this
information. As you tried, it won't give it to us with %_ but it'd be
better in somewhere like compstate anyway.

> The problem is that you end up with too many layers of autoremovable
> suffixes.  When completing a path name within backticks, you can't
> get both the trailing / on a directory name and the trailing backtick.

Multiple layers of autoremovable suffixes is clearly one of the things
that needs some thought. Possibly all should be added but they would
each have separate lists of characters which would result in their
removal. Then if a suffix is auto-removed, subsequent suffixes also need
removing.

When adding matches for completion, it is common (such as with
directories in _files or `http://' in _urls that the match only makes up
a part of what the function completes (such as `http://' which is
clearly only a partical url). So _urls does not add any suffixes it was
passed with -S and anything like backquotes should also not be added.
The opposite is also simple where a function completes something which
can only be the final portion and so any suffixes are added.
Auto-removable suffixes are a nice way of handling things which can be
final or partial and it can vary as to which is the best assumption
hence the need for a better system for defining what it'll do.

> } Also, without multios the closing
> } bracket of $(<...) should always be completed.
> 
> It would have to be an autoremovable suffix, too; `echo $(<file wc)' is
> a silly example of why.

I never knew you could do that. Still, ')' as an autoremovable suffix
would be better behaviour than the current situation.

Oliver

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp



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