zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: alias hygiene
Date: Sat, 17 Feb 2018 18:10:02 -0800	[thread overview]
Message-ID: <180217181002.ZM27805@torch.brasslantern.com> (raw)
In-Reply-To: <05e4360b-4989-af2b-70b6-79c2aef06f95@eastlink.ca>

On Feb 17,  4:17pm, Ray Andrews wrote:
}
} That doesn't sound too terrible, not some actualnew construction? So a 
} function can be a widget?

Sort of.  A function can be one component of a widget.  The other parts
of a widget are the bit of zsh internals that explains how it works in
ZLE, and the name used to refer to the whole composite.  A "user-defined"
widget has a shell function, those internals, and a name.  A "builtin"
widget has C code, internals, and a name.

} Show me one that I can understand

Daniel tried to do so a few messages ago, in users/23134.  You create a
widget with either "zle -N" (which sets up the internals for a "normal"
widget and attaches the name) or "zle -C" (which sets up internals for
completion and names it).

Once you have one of those objects you can use its name in "bindkey".

} When would I call 
} something a widget, not a function? When it's associated with ZLE?

Approximately, yes.  Most of the time it's convenient if the widget and
the function that implements it have the same name, but that's not a
requirement; for example, many function that implement searches or line
motions can handle going both forward and backward, so there will be
two widget names but only one function.


  reply	other threads:[~2018-02-18  2:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 16:09 Ray Andrews
2018-02-17  0:30 ` Daniel Shahaf
2018-02-17  3:14   ` Ray Andrews
2018-02-17 13:54     ` Daniel Shahaf
2018-02-17 15:20       ` Ray Andrews
2018-02-17 15:30         ` Daniel Shahaf
2018-02-17 15:42           ` Ray Andrews
2018-02-17 22:04             ` Bart Schaefer
2018-02-18  0:17               ` Ray Andrews
2018-02-18  2:10                 ` Bart Schaefer [this message]
2018-02-18  3:38                   ` Ray Andrews
2018-02-19  6:37                     ` Bart Schaefer
2018-02-27 13:48           ` Vincent Lefevre
2018-02-27 15:26             ` Ray Andrews
2018-02-17 15:36       ` Daniel Shahaf
2018-02-17 21:40     ` Bart Schaefer
2018-02-18  0:08       ` Ray Andrews
2018-02-19  6:28   ` Bart Schaefer
2018-02-19 18:14     ` Ray Andrews

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=180217181002.ZM27805@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).