zsh-workers
 help / color / mirror / code / Atom feed
* Re: completion parameter suggestion
@ 1999-02-24 12:28 Sven Wischnowsky
  1999-02-24 10:09 ` Sven Wischnowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 1999-02-24 12:28 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> > (I'm asking a lot of questions lately, but I hope you agree that this
> > is correct behavior.)
> 
> It depends what you think of the answers...

Any answer is better than no answer.

> >   - `matcher_num': what now is `MATCHER' which will be removed
> 
> Since `num' is not a word, I'd be quite happy with just `matcher' as
> before.

I thought of giving the match spec string as `matcher'. But we can
easily (probably better) use `matcher' for the number, and give the
string as `matcher_string'.

> >   - `num_matches': what now is `NMATCHES'
> 
> Same problem: nmatches is probably just as good here.  It looks sufficienly
> like $n_\mathrm{matches}$ for anyone with a mathematical upbringing.  It
> would be nice to have something neater, but the only thing I can think of
> is `matchcount'.

This was a last minute change as I thought I recalled some complaint
about it. Maybe I was just wrong.

> >   - `quote':       either a ` or a ", depending on the quoting the
> >                    code thinks we are in
> 
> How about 'single' or 'double', since most of the context is going to be in
> words?

That's what I suggested first, Bart suggested giving the quote
itself. Again, we could make this `quote=single/double' and
`quote_char='/"'.

> >   - `norestore':   this is always restored on exit of a function; if
> >                    it is set on exit, the parameters above will not be 
> > 		   reset to the values they had when the function was
> > 		   entered (with this we can finally implement helper
> > 		   functions that do tests and modify the parameters
> > 		   without having to make the helpers call other
> > 		   functions that produce the matches)
> 
> But num_matches will be changed anyway if new matches were added in the
> function, so in most cases you won't want to restore that on exit anyway.

I was talking about the parameters, not the keys (i.e. only `PREFIX',
`SUFFIX', `IPREFIX', `CURRENT', and `words'  would be restored).

>   $context[menuitem] = "11/20"   11th out of 20 shown (blank if not
>                                  menu-completing)
> on exit
>   context[menuitem]=14           insert the fourteenth match
>                                  (use existing number to determine new one)
>   context[menuitem]=accept       accept the current one   ) initial letter
>   context[menuitem]=continue     accept-and-menu-complete ) probably OK

One of my thoughts was to use the `insert' key for things like this,
too (and also played with `<number>' and `accept' or `next' and
`previous').

> On the other hand, with a special associative array polluting the name
> space is not such a big worry.

Right.

> My dream is of being able to highlight an item in the list and move through
> it with the cursor keys to pick one.  It's not impossible --- add some
> highlight information when sending to zle_refresh(), remember rows and
> columns, hit return to accept, escape to cancel the selection cursor ---
> but it's still a way off.

When this was added to Emacs (or, at least when I saw that this is
possible in Emacs) I had the same idea. But then, I only seldom use
menucompletion and always have problems imagining what people using it 
would like.

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: completion parameter suggestion
@ 1999-02-26 12:20 Sven Wischnowsky
  1999-02-28  3:09 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 1999-02-26 12:20 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> So ... this means that changes to `words' would not cause zsh to try to
> automatically update the rest of `compstate'?

In the `compstate' I described there isn't anything that would have to 
be updated (context stays the same and so on...). That's the reason
why I didn't suggest putting `CURRENT' in `compstate' and why I want
to remove the `argument' context.

> Incidentally, I've never been clear on where the "matcher number" is
> coming from in the first place, nor what one would use it for.  Maybe I
> just haven't looked through the examples closely enough.

One can give more than one global match specs (`compctl -M 'spec1' 'spec2'...),
these are tried by the completion code in order (they are `xor'ed... ouch! ;-).
`MATCHER' is the number of the one which is currently tried.

> Suppose I'm in the middle of ${$(...)}.  What's the context?  What's
> the context inside $'...'?

In the first case: `command', as always inside `$(...)'. For $'...':
same as '...'.

>  >   - `norestore':   this is always restored on exit of a function; if
>  >                    it is set on exit, the parameters above will not be 
>  > 		   reset to the values they had when the function was
>  > 		   entered
> 
> Let's try to avoid negatives, shall we?  Call it `restore' or `local' and
> have it default to set, and you unset it to prevent value restoration.  Or
> call it `scope' defaulting to `local' and you set it to `export' to make
> the other values not be restored.  But don't use a leading `no'.

Ok.

>  >   - `insert':      on entry this would be set to `menu', `automenu',
>  >                    `unambiguous'
> 
> This sounds OK too, but maybe `prefix' rather than `unambiguous'.
> Maybe.

I thought about `prefix', but decided against it since this hasn't to
be a prefix (even in older versions it could be a prefix and a suffix, 
with the matching stuff this could be a set of prefixes and suffixes).

> Two suggestions: (1) `exact' should be a possible value of the `insert'
> element mentioned above; (2) the element named `exact' should either be
> unset (when there is no exact match) or set to $word[CURRENT].  (I don't
> have a good argument for that setting, it just feels more useful than
> `yes' or `insert'.)

Again, I thought about exacly this, too. Setting `exact' to the
string: yes, possibly, I just couldn't think of something where we
might use it, but that wouldn't be a reason not to use it. But I tried 
to make the other keys contain only values that are used on entry and
after exit (with the same strings). So if we set `exact' to the match, 
the user may think that setting it to some string may make this string 
be inserted in the line. That is also the reason why I decided against 
using `exact' as one of the values for `insert'. If recexact and
automenu is set: which value should the completion code store in
`insert' (since it doesn't know if there will be an exact match
generated).

> How about another associative array called `menustate' that holds all
> these things?

As for the menu stuff, ok. But the list stuff isn't connected to
(only) menucompletion.

> The other possibility would be to automatically insert a dummy element 0
> into `words' when ksharrays is set, and automatically remove it when
> ksharrays changes.  That could be done without hooking into the option
> code if `words' was a special array with a special get-function.

Hadn't thought about that, yes maybe... (but it's the other way round, 
isn't it?)

Bye
 Sven


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


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

end of thread, other threads:[~1999-02-28  3:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-24 12:28 completion parameter suggestion Sven Wischnowsky
1999-02-24 10:09 ` Sven Wischnowsky
1999-02-24 10:32   ` Peter Stephenson
1999-02-26  5:24     ` Bart Schaefer
1999-02-26 12:20 Sven Wischnowsky
1999-02-28  3:09 ` Bart Schaefer

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