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

Re: Completion problems.



In article <199908021058.MAA12713@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> That's wrong, too. Again, this is a problem with the recently changed
> quoting behaviour. The prefix is reported in quoted form and appended
> and prepended to IPREFIX/ISUFFIX -- which will be quoted again when it 
> is inserted.

Thanks. It is fixed.  But such a unquoting/re-quoting seems bit
problematic with variables.

Z(3):akr@is27e1u11% Src/zsh -f
is27e1u11% fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { compset -P '*/'; compadd tst }
is27e1u11% var=val
is27e1u11% tst $var/<TAB>

Then, the last line is changed to:

is27e1u11% tst \$var/tst 

I think automatic unquoting/re-quoting is dangerous.

Since the completion code works on quoted form and unquoted form is
only interesting to usual completers, definitely the conversion
between these forms is required. But it is sometimes very difficult or
even impossible.

In following examples, unquoted forms are not known until runtime.

% if some-complex-command; then var=xxx; else var=yyy; fi; tst $var/<TAB>
% tst $(some-complex-command)/<TAB>

So, I think that it is dangerous decision to embed the quoting stuff
into the completion code.

I think that it is right way to separate the quoting stuff to builtin
or variable expansion.

Also, I don't like re-quoting such as:

% tst a'#'/<TAB>
->
% tst a\#/...

My expectation to completion is simply inserting something into cursor
position. So re-quoting surprise me.  If the quoting stuff is
separated, customizing these behaviours may be easier.

Also, making the quoting stuff usable from completers is useful for
checking the array words. For example, currentry, following does not
work because contents of words are quoted form and $words[2] is
"'-d'".

% cvs '-d' <TAB>

If _cvs can unquote the word safely, _cvs can determin options more
precisely.
(Although we can use eval, I think eval is evil.)
-- 
Tanaka Akira



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