zsh-users
 help / color / mirror / code / Atom feed
From: Borzenkov Andrey <Andrej.Borsenkow@mow.siemens.ru>
To: "'Jonas Juselius'" <jonas@iki.fi>, zsh-users@sunsite.dk
Subject: RE: zstyle problems
Date: Wed, 2 Oct 2002 12:16:08 +0400	[thread overview]
Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B464@mowd019a.mow.siemens.ru> (raw)
In-Reply-To: <20021002075023.GA802@chem.helsinki.fi>

> but I still think this is a bit confusing. Typing 'cd' and then
> pressing ^Xh says 'tags in context :completion::complete:cd::', which
> made me think that this was the actual context...

That is correct for the time when actual completion for cd is done. 
But completion is a hierarchical process, and it looks up styles at
different steps, so in early stage some information is not yet
available.

When completion starts, it knows only

- it is completion :-)
- actual command line contents
- whether it has been called as default, context sensitive, completion
or explicitly as special completion widget.

So at this stage it can just fill  in the first two fields, notably

:completion:     :
     ^        ^
     |        + default completion (for a widget here is a widget name)

     + completion (as opposed to e.g. styles for zftp function
sybsystem)

The first step it does at this point (after some initialization) is to
decide what completer to use. It is completer that actually generates
matches. Because the above is the only available information, completion
looks up completer(s) using the context :completion:::::, for a
complete-history widget this would be (probably)
:completion:history-complete::::.

Then completer fills in next part of context, then it decides if we are
completing command, parameter etc and fills in next part of context etc.

I too wish it is better described in manuals. At least, those cases when
styles are looked up using non-standard context definitely must be made
clear. Unfortunately, most examples overuse wildcards thus hiding this.

> What would be the
> correct way of defining different (individual) completions for 'cd'
and
> other
> commands?
>

Mostly it is what you have done. For cd context is
:completion::complete:cd:: with optional specific tag names appended.
For completion based on _arguments you may add argument-N or option-N as
last part to modify completion for specific options/arguments. You may
also use :completion:*:... for both default context sensitive completion
and completion widgets.



-andrey


  reply	other threads:[~2002-10-02  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-01 11:34 Jonas Juselius
2002-10-01 11:43 ` Jonas Juselius
2002-10-02  3:15 ` Bart Schaefer
2002-10-02  7:50   ` Jonas Juselius
2002-10-02  8:16     ` Borzenkov Andrey [this message]
2002-10-02  8:33     ` Bart Schaefer
2002-10-02  9:28       ` Jonas Juselius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6134254DE87BD411908B00A0C99B044F03A0B464@mowd019a.mow.siemens.ru \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=jonas@iki.fi \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).