zsh-workers
 help / color / mirror / code / Atom feed
From: DervishD <raul@pleyades.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh <zsh-workers@sunsite.dk>
Subject: Re: Tags in function files
Date: Wed, 17 Sep 2003 21:37:09 +0200	[thread overview]
Message-ID: <20030917193709.GA283@DervishD> (raw)
In-Reply-To: <1030917163041.ZM5852@candle.brasslantern.com>

    Hi Bart :))

    Thanks a lot for your exhaustive answer, I've learned a lot :)

 * Bart Schaefer <schaefer@brasslantern.com> dixit:
> }     OK, thanks :) BTW, the special parameters as 'words' and the
> } like, are too created and initialized by compinit (I mean, the new
> } completion system...)?
> No, those are set up by the ZLE internals.  However, they're provided
> only to "completion widgets", which means those created with "zle -C"
> (as opposed to those created with "zle -N").

    OK, now all makes sense. I was testing with a dummy widget (NOT a
completion one...) and I was able to use 'zle complete-word' inside
my widget, but I couldn't use '$words' (it expanded to nothing). On
the other hand, I created a dummy completion widget with zle -C but
then I wasn't able to use the predefined widgets inside. Namely
something like this:

my_comp () {
    zle .complete-word
}

zle -C dummycomp complete-word my_comp

bindkey "^O" dummycomp

    When I hit '^O' zsh complains:

my_comp:zle:1: widgets can only be called when ZLE is active

    Is this intended or am I totally clueless? I mean, instead of
using compadd, I would like to be able to last-resort to some
predefined completion widget, or even call some zle widget to move
the cursor, retrieve the story, clean the command line, etc... That
is, using some of the zle facilities inside my completion widget.

> The new completion system

    I really like your suggestion, let's call it compsys ;)))

> is an extensive example of what can be
> accomplished with "zle -C" plus the "compadd" builtin.

    I've been reading some of the functions: compinit, compadd, some
of the _* functions, etc... It's a very good job, truly. I'm amazed...
 
> Then for finer control you can get into playing with the values of
> the "compstate" parameter.  You probably got all that already from
> PWS's user guide, intro to chapter 6.

    I've read the entire guide, since it seems to be pretty valid
(only minor differences with my version of zsh). In fact I've learned
a lot of zsh, not only completions, but globbing, parameter
expansion, zle, etc... The guide is great. Now I feel like I can go
for the Zsh manual ;))) In the interim I'm reading the FAQ.

> } $words doesn't seem to work, so I'm thinking about using 'BUFFER' for
> } command line parsing in order to call one of the completion functions
> } I need. Like _main_complete, but lots simpler.
> Keep in mind that one of the things _main_complete does is reset a whole
> lot of setopts to be sure that all completion functions operate in the
> same syntactic environment.

    Oh, yes, I know, but I just want to learn and make some
completions work in my box. I will try my best to set the options so
if I made a change it doesn't affect the completions.

> If, for example, you setopt KSH_ARRAYS, then
> the behavior of things like $words won't match the compsys documentation.

    My problem with the compsys documentation is that I don't know
which parameters, tags and the like are defined by compsys and which
ones are controled by Zsh guts ;)) I'm learning, slowly but surely ;)
 
> A handy debugging tool for widgets of any sort is "zle -M".  E.g.:

    THANKS!!!! That's nice!

    Thanks again for your kind answer. This is a difficult issue for
me and I really don't have all the time I would like to put it on
learning Zsh, and your help is very valuable.

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/


  reply	other threads:[~2003-09-17 19:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-16 20:35 DervishD
2003-09-17  7:48 ` Oliver Kiddle
2003-09-17  8:37   ` DervishD
2003-09-17 16:30     ` Bart Schaefer
2003-09-17 19:37       ` DervishD [this message]
2003-09-18  3:44         ` Bart Schaefer

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=20030917193709.GA283@DervishD \
    --to=raul@pleyades.net \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@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).