zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Risto Laitinen <risto.laitinen@gmail.com>, zsh-workers@zsh.org
Subject: Re: [PATCH] zed fails with setopt nounset unless option -x is given
Date: Fri, 20 May 2022 15:17:22 +0100 (BST)	[thread overview]
Message-ID: <641523655.251203.1653056242563@mail2.virginmedia.com> (raw)
In-Reply-To: <CAA-Ti-jiCVGAGF6XMi2axwcwkkHrCGzyvh9Biaf-d=qT443pLg@mail.gmail.com>

> On 20 May 2022 at 15:06 Risto Laitinen <risto.laitinen@gmail.com> 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


  reply	other threads:[~2022-05-20 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 14:06 Risto Laitinen
2022-05-20 14:17 ` Peter Stephenson [this message]
2022-05-20 14:39   ` Bart Schaefer
2022-05-20 15:00   ` Bart Schaefer
2022-05-25  9:48   ` 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=641523655.251203.1653056242563@mail2.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=risto.laitinen@gmail.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).