From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] add-zle-hook-widget
Date: Tue, 21 Jun 2016 15:58:11 -0700 [thread overview]
Message-ID: <160621155811.ZM9407@torch.brasslantern.com> (raw)
In-Reply-To: <20160621014131.GB17100@tarsus.local2>
On Jun 21, 1:41am, Daniel Shahaf wrote:
} Subject: Re: [PATCH] add-zle-hook-widget
}
} Bart Schaefer wrote on Sat, Jun 18, 2016 at 16:25:58 -0700:
} > for hook in $hooktypes
} > do
} > + # Check for an existing widget, add it as the first hook
} > + if [[ ${widgets[$hook]} = user:* ]]; then
} > + zle -A "$hook" "${widgets[$hook]}"
} > + zstyle -- "$hook" widgets 0:"${widgets[$hook]}"
}
} The last parameter expansion should strip the "user:" prefix.
No, it shouldn't, because the "zle -A" command creates a new widget
whose name begins with "user:".
This way if you run "add-zle-hook-widget -L" it will show you that the
widget with index zero was the user's previously defined widget.
Yes, this breaks things if the user's widget compares itself to $WIDGET
but there's no way around that [*] because the newly created hook is
the only widget allowed to use the reserved hook-widget name.
[*] A possible fix for this is to omit the -w when calling the widget
from zle, so that $WIDGET remains the hook-widget. That would look
something like
for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do
if [[ "$hook" = user:* ]]; then
# Do not change $WIDGET, it may be tested in $hook
zle "$hook" -N "$@" || return
else
zle "$hook" -Nw "$@" || return
fi
done
next prev parent reply other threads:[~2016-06-21 22:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 1:44 Bart Schaefer
2016-06-13 8:52 ` Daniel Shahaf
2016-06-14 18:10 ` Bart Schaefer
2016-06-14 21:06 ` Bart Schaefer
2016-06-15 23:24 ` Daniel Shahaf
2016-06-17 5:20 ` Bart Schaefer
2016-06-18 23:25 ` Bart Schaefer
2016-06-21 1:41 ` Daniel Shahaf
2016-06-21 22:58 ` Bart Schaefer [this message]
2016-06-21 1:41 ` Daniel Shahaf
2016-06-22 20:25 ` Bart Schaefer
2016-07-01 5:11 ` Daniel Shahaf
2016-07-01 20:11 ` Bart Schaefer
2016-07-05 4:57 ` Daniel Shahaf
2016-07-14 7:45 ` 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=160621155811.ZM9407@torch.brasslantern.com \
--to=schaefer@brasslantern.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).