zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: pws@ifh.de (Peter Stephenson)
Cc: zsh-workers@math.gatech.edu
Subject: Re: a plan for ZLE extendability
Date: Thu, 5 Dec 1996 16:04:48 +0000 (GMT)	[thread overview]
Message-ID: <638.199612051604@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199612051421.PAA27640@hydra.ifh.de> from "Peter Stephenson" at Dec 5, 96 03:21:30 pm

>this sounds fine... someone ought to make a few comments...

That's what I thought.  I'm surprised no one has responded up to now.

>You can avoid $ZLE_BUFFER by doing like what completion does and
>passing the buffer as arguments $1 and $2 of the function.  I think
>the drawback is you need some kind of arrangement with the function
>call mechanism to get the returned values of $1 and $2; maybe nested
>functions are less intuitive and less efficient this way, too.

I considered using the positional parameters -- actually I would have
used them for the thingy stack -- but I decided that the hiding of
these parameters when another function is called would make it
inappropriate.  I don't like this aspect of completion functions,
partly for this reason.  It is also aesthetically displeasing, and
illogical, to make changes to the buffer by assigning to the function's
arguments.

>What's the objection to e.g. having a special option to zle that
>causes the arguments to be executed immediately?  Or one that causes
>just the top N thingies on the stack to be executed (or the possibility
>of both)?  That would avoid having special thingies.

The effect of such an option would be equivalent to pushing one of the
special thingies, and then the thingies specified.  There would in
practice still be a need for a special thingy.  (There's no overhead in
that; there are other things that require thingies to have flags too.)
The syntax I am currently leaning towards would have

zle -h

to push a special thingy, {h}iding the rest of the stack; normal
thingies could also be specified, so

zle -h get-key

would push a special thingy and then push and execute get-key.  The
result would be the key read as the only visible thingy on the stack;
after that had been popped, the special thingy could be popped.  Is
this close enough to what you had in mind?

>                                                 I think in any case
>bindkey -s can easily be rescued to store an appropriate sequence.

Of course, the existing semantics of bindkey -s would be emulated.

>I didn't quite get whether thingies are typed: are (1) thingies
>interpreted as functions when first popped and only as strings when
>required as an argument, or (2) either pushed on the stack as
>functions or as strings?  If (2) then a string encountered as a
>function can simply be sent without needing any specific send-string
>function.

(1).  Each thingy (apart from the special hiding thingy) is just a
string, as far as the user is concerned.  (Internally the thingy also
has a couple of flags.)  When a function execution is requested, the
top thingy on the stack is popped and looked up as a function name, and
that function is then executed.  In any case, automatically pushing
executed strings back onto the input would be inappropriate.  Tty input
is not fundamental to this model of ZLE; it's just something handled by
the get-key function (with which send-string collaborates).  A user
could even redefine get-key and send-string, to take input from
somewhere else.

-zefram


  reply	other threads:[~1996-12-05 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-02 12:58 Zefram
1996-12-05 14:21 ` Peter Stephenson
1996-12-05 16:04   ` Zefram [this message]
1996-12-06  8:46     ` Peter Stephenson

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=638.199612051604@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).