zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: zle_line_init_functions (Re: accept-line-and-down-history and push-input)
Date: Sun, 31 Oct 2010 21:54:50 +0000	[thread overview]
Message-ID: <20101031215450.06b7ed7b@pws-pc.ntlworld.com> (raw)
In-Reply-To: <101027084031.ZM31108@torch.brasslantern.com>

On Wed, 27 Oct 2010 08:40:31 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Also either way I think zle_line_init_whatever should preserve the
> behavior of abandoning the remaining hooks if any one of them fails.

That's easy and sensible --- I interpret "fails" as errflag != 0.

> } If you have the behaviour buried in the widget itself it looks
> } different from the other hooks which are independent of the definition
> } of the base function.
> 
> That's a different issue, and one where now that you point it out, I
> agree with you.  Rather than have zle-line-init itself walk through
> the array, I'd amend to suggest a second nameless widget that can't
> be replaced by "zle -N" whose purpose is to walk the array, following
> the structure of your patch in user/15493 more closely.

This isn't so different from what I proposed, and has the attractive
feature that you only have the one namespace --- there's no point in
having functions named differently from widgets if you're explicitly
saying which to call, so that makes sense.

An unnamed widget doesn't fit in well with the scheme of defining
widgets, so I called it hook-runner.

Alas, it still doesn't work.  Because the widget is built-in, there's no
point at which the zle parameters get added --- the hierarchy is
builtin widget -> ordinary shell function --- so you can't see (e.g.)
$KEYMAP, which is crucial to being able to handle zle-keymap-select
neatly.

So we need a function widget at the top level, as in my original
proposal, or rewrite the internals, a route I'm not going to take ---
that doesn't mean it's not workable, it just means I've decided I've
tried hard enough at this point.

> } Also, if you do it the other way, within zle you have to do something
> } more complicated than I've just written that performs an extra level
> } of indirection to call a whole heap of other widgets.
> 
> I'm not following the origin of this whole heap of other widgets.
> 
> } Then all the widgets have to be predefined in the appropriate
> } configuration file.
> 
> We must have disconnected somewhere because this is (a previously
> unstated) part of my objection to a zle_line_init_widgets array.

The point was that in your original suggestion you'd need *always* to
have widgets called zle-line-init etc., even if they didn't do anything,
just to run the hooks, even if you hadn't defined any.  In my scheme
you'd only have widgets defined when they'd be run in a hook.

> } It doesn't make sense to me to have a whole new set of callable zle
> } functions that aren't widgets, it creates a new category that blurs
> } the boundaries.
> 
> I think that's a barn from which the horse has already escaped; we
> already special tests used in traps when called from zle, various
> "Utility Functions" like modify-current-argument, and of course the
> entire collection of completers and their helpers.

In these cases the functions aren't called from zle directly.  There's
at least one case where a function is, however, which is a zle -F
handler; but that doesn't do editing, it just handles input, and is
deliberately written so the function doesn't interact with the editor.
I agree the distinctions are a bit blurry for your average user, though.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2010-10-31 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTin4qeNKcBt_TDzY2xt-XJ6aHVH257FOa6iriPSm@mail.gmail.com>
     [not found] ` <101026075546.ZM28500@torch.brasslantern.com>
     [not found]   ` <20101026161947.19279c58@pwslap01u.europe.root.pri>
2010-10-27  5:01     ` Bart Schaefer
2010-10-27  9:22       ` Peter Stephenson
2010-10-27 15:40         ` Bart Schaefer
2010-10-31 21:54           ` Peter Stephenson [this message]
2010-11-01  7:01             ` 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=20101031215450.06b7ed7b@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /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).