Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/2] add-zle-hook-widget: Support running under NO_UNSET ('set -u').
- X-seq: zsh-workers 43685
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/2] add-zle-hook-widget: Support running under NO_UNSET ('set -u').
- Date: Fri, 12 Oct 2018 13:40:36 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=from:to:subject:date:message-id; s=fm1; bh=L6nTyHjameyHcgZvCOz3bQzmUubzJ84HQMymMEWw7Q0=; b=Pflm8kDB7FFT Q2CLDBokTNqJVGuiK5fefboAJRzmtcsPwRKt5+f7Lp+QtNgAZG+yQULwKO2jEsQG D8WJXl9IADe3Dj8bargKRcRpMQUY3aLG1UrNIpbnxjPDSE0cNq3mhtxM+L5tFCRQ zp5wpuZL9g5YVf2d1cjq5cTc7HGIwmQR+wV29z8Emasnjbe3qpBjMcLfy/vBrCl0 vboKdtupFBRdFZ1z4B/Os2NRMe3vLBYMsHD2qgM7vFLcY53UpiZFT73AvQRX/rs9 cGnE31UIvvxpJ+8QAernmT5gfjxEPtOwQGX6SiA+ASWroE2txNmxtn33XvS2OPC+ Eo6jPwEqNw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=L6nTyHjameyHcgZvCOz3bQzmUubzJ84HQMymMEWw7Q0=; b=SZW42tzj DJFlPUGyu4qipJArNYYsy3dPbJ5GmyIZdUz1jZz0IBczMBZhALO/dtEYZrmP38N3 SLHhnzzEOScnlkUfJX4zcPyJu3Jn9OIAH16SKwhrj6dlJ/zDxchW8Od0hsOMnT+J Nc7drz+uuM++LUlQErEHZ4aEUHftmzDXiQ8nrt8fQMENtckKOuMMhhWk3TXf2tOf B97JQXPaY/PA6Hr8s3M9Dy8gZLO4uWbW24uU2hN33d3cPJUM/8xtqcMI0X9LhX/U 18ENXEyTmLdJYfxXwzxBO/WtZ5O5FG5z9X8R6eaq4fA4IknttoS5ALh3sC3iFQuu mtMfUyL4KLG/1Q==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
---
Functions/Misc/add-zle-hook-widget | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget
index d8a3950fb..9cc35496f 100644
--- a/Functions/Misc/add-zle-hook-widget
+++ b/Functions/Misc/add-zle-hook-widget
@@ -129,7 +129,7 @@ function add-zle-hook-widget {
else
# Check whether attempting to add a widget named for the hook
if [[ "$fn" = "$hook" ]]; then
- if [[ -n "${widgets[$fn]}" ]]; then
+ if (( ${+widgets[$fn]} )); then
print -u2 "$funcstack[1]: Cannot hook $fn to itself"
return 1
fi
@@ -141,8 +141,8 @@ function add-zle-hook-widget {
integer i=${#options[ksharrays]}-2
zstyle -g extant_hooks "$hook" widgets
# Check for an existing widget, add it as the first hook
- if [[ ${widgets[$hook]} != "user:azhw:$hook" ]]; then
- if [[ -n ${widgets[$hook]} ]]; then
+ if [[ ${widgets[$hook]:-} != "user:azhw:$hook" ]]; then
+ if [[ -n ${widgets[$hook]:-} ]]; then
zle -A "$hook" "${widgets[$hook]}"
extant_hooks=(0:"${widgets[$hook]}" "${extant_hooks[@]}")
fi
@@ -152,17 +152,17 @@ function add-zle-hook-widget {
if [[ -z ${(M)extant_hooks[@]:#(<->:|)$fn} ]]; then
# no index and not already hooked
# assign largest existing index plus 1
- i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]}+1
+ i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]:-0}+1
else
return 0
fi
extant_hooks+=("${i}:${fn}")
zstyle -- "$hook" widgets "${extant_hooks[@]}"
- if [[ -z "${widgets[$fn]}" ]]; then
+ if (( ! ${+widgets[$fn]} )); then
autoload "${autoopts[@]}" -- "$fn"
zle -N -- "$fn"
fi
- if [[ -z "${widgets[$hook]}" ]]; then
+ if (( ! ${+widgets[$hook]} )); then
zle -N "$hook" azhw:"$hook"
fi
fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author