From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: pws-N: zle -l
Date: Tue, 22 Jun 1999 18:30:13 +0200 [thread overview]
Message-ID: <9906221630.AA35271@ibmth.df.unipi.it> (raw)
Does this look alright?
I deleted some obsolete options to the zle command. Only -c did anything,
but I imagine everyone's code now uses zle -C.
--- Doc/Zsh/mod_zle.yo.lb Sun Jun 20 16:13:07 1999
+++ Doc/Zsh/mod_zle.yo Tue Jun 22 18:25:17 1999
@@ -161,7 +161,7 @@
cindex(calling widgets)
cindex(widgets, defining)
cindex(defining widgets)
-xitem(tt(zle) tt(-l) [ tt(-L) ])
+xitem(tt(zle) tt(-l) [ tt(-Labr) ])
xitem(tt(zle) tt(-D) var(widget) ...)
xitem(tt(zle) tt(-A) var(old-widget) var(new-widget))
xitem(tt(zle) tt(-N) var(widget) [ var(function) ])
@@ -175,8 +175,17 @@
item(tt(-l) [ tt(-L) ])(
List all existing user-defined widgets. If the tt(-L)
option is used, list in the form of tt(zle)
-commands to create the widgets.
-Built-in widgets are not listed.
+commands to create the widgets; this is incompatible with any of the
+options tt(-a), tt(-b) or tt(-r). If the option tt(-b) is given, builtin
+widgets (including aliases) are listed, and if tt(-a) is given, all widgets
+are listed.
+
+In the normal listing format (without tt(-L)), a function name for a
+user-defined widget is shown in parentheses only if it differs from the
+widget name; if a builtin widget is an alias for another, the name of the
+other widget is shown following the string `tt( -> )'. If the option
+tt(-r) is given, a listing in raw format, consisting just of the names of
+the widgets, is shown.
)
item(tt(-D) var(widget) ...)(
Delete the named var(widget)s.
--- Src/Zle/zle_main.c.lb Tue Jun 22 10:02:48 1999
+++ Src/Zle/zle_main.c Tue Jun 22 18:10:38 1999
@@ -953,7 +953,7 @@
static struct builtin bintab[] = {
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaMldDANmrsLR", NULL),
BUILTIN("vared", 0, bin_vared, 1, 7, 0, NULL, NULL),
- BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLmMgGcR", NULL),
+ BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLRbar", NULL),
};
/* The order of the entries in this table has to match the *HOOK
--- Src/Zle/zle_thingy.c.lb Sun Jun 20 14:56:39 1999
+++ Src/Zle/zle_thingy.c Tue Jun 22 18:15:11 1999
@@ -369,11 +369,28 @@
return op->func(name, args, ops, op->o);
}
+#define ZLIST_INT 1
+#define ZLIST_USR 2
+#define ZLIST_CMD 4
+#define ZLIST_RAW 8
+
/**/
static int
bin_zle_list(char *name, char **args, char *ops, char func)
{
- scanhashtable(thingytab, 1, 0, DISABLED, scanlistwidgets, ops['L']);
+ int flags = ops['r'] ? ZLIST_RAW : 0;
+ if (ops['L']) {
+ if (ops['b'] || ops['a'] || ops['r']) {
+ zwarnnam(name, "incompatible options for listing", NULL, 0);
+ return 1;
+ }
+ flags |= ZLIST_CMD;
+ }
+ if (!ops['b'])
+ flags |= ZLIST_USR;
+ if (ops['a'] || ops['b'])
+ flags |= ZLIST_INT;
+ scanhashtable(thingytab, 1, 0, DISABLED, scanlistwidgets, flags);
return 0;
}
@@ -405,9 +422,11 @@
Thingy t = (Thingy) hn;
Widget w = t->widget;
- if(w->flags & WIDGET_INT)
+ if (((w->flags & WIDGET_INT) && !(list & ZLIST_INT)) ||
+ (!(w->flags & WIDGET_INT) && !(list & ZLIST_USR)))
return;
- if(list) {
+ if (list & ZLIST_CMD) {
+ DPUTS(w->flags & WIDGET_INT, "BUG: zle -lL with internal widget");
printf("zle -%c ", (w->flags & WIDGET_NCOMP) ? 'C' : 'N');
if(t->nam[0] == '-')
fputs("-- ", stdout);
@@ -423,15 +442,23 @@
}
} else {
nicezputs(t->nam, stdout);
- if (w->flags & WIDGET_NCOMP) {
- fputs(" -C ", stdout);
- nicezputs(w->u.comp.wid, stdout);
- fputc(' ', stdout);
- nicezputs(w->u.comp.func, stdout);
- } else if(strcmp(t->nam, w->u.fnnam)) {
- fputs(" (", stdout);
- nicezputs(w->u.fnnam, stdout);
- fputc(')', stdout);
+ if (! (list & ZLIST_RAW)) {
+ if (w->flags & WIDGET_NCOMP) {
+ fputs(" -C ", stdout);
+ nicezputs(w->u.comp.wid, stdout);
+ fputc(' ', stdout);
+ nicezputs(w->u.comp.func, stdout);
+ } else if (w->flags & WIDGET_INT) {
+ if (t != w->first && t->nam[0] != '.' &&
+ w->first->nam[0] != '.') {
+ fputs(" -> ", stdout);
+ nicezputs(w->first->nam, stdout);
+ }
+ } else if (strcmp(t->nam, w->u.fnnam)) {
+ fputs(" (", stdout);
+ nicezputs(w->u.fnnam, stdout);
+ fputc(')', stdout);
+ }
}
}
putchar('\n');
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
next reply other threads:[~1999-06-22 16:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-22 16:30 Peter Stephenson [this message]
1999-07-12 7:24 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=9906221630.AA35271@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.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).