Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] zed fails with setopt nounset unless option -x is given
- X-seq: zsh-workers 50263
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Risto Laitinen <risto.laitinen@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: [PATCH] zed fails with setopt nounset unless option -x is given
- Date: Fri, 20 May 2022 15:17:22 +0100 (BST)
- Archived-at: <https://zsh.org/workers/50263>
- Importance: Medium
- In-reply-to: <CAA-Ti-jiCVGAGF6XMi2axwcwkkHrCGzyvh9Biaf-d=qT443pLg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAA-Ti-jiCVGAGF6XMi2axwcwkkHrCGzyvh9Biaf-d=qT443pLg@mail.gmail.com>
> On 20 May 2022 at 15:06 Risto Laitinen <risto.laitinen@xxxxxxxxx> wrote:
> % zsh-5.9 -f
> % autoload zed
> % setopt nounset
> % zed a.txt
> zed:21: opts[-x]: parameter not set
> %
Looks straightforward.
zed runs as "emulate zsh"; it seems reasonable that nounset isn't
treated as an emulation option, given it's more for debugging, but
that means there could well be a lot more of these lurking.
pws
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index 7d0d590db..582a15d25 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -18,7 +18,7 @@ zparseopts -D -A opts f h b x:
fun=$+opts[-f]
hist=$+opts[-h]
bind=$+opts[-b]
-if [[ $opts[-x] == <-> ]]; then
+if [[ $+opts[-x] == 1 && $opts[-x] == <-> ]]; then
expand=(-x $opts[-x])
elif (( $+opts[-x] )); then
print -r "Integer expected after -x: $opts[-x]" >&2
Messages sorted by:
Reverse Date,
Date,
Thread,
Author