From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: PATCH: unwanted error aborting continued command substitution
Date: Fri, 17 Apr 2015 10:16:00 +0100 [thread overview]
Message-ID: <20150417101600.09a17a9e@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAHYJk3T2jd238ZCh1mtNorNKZJ0H8U6wQeTA_VYX2aDiXmAt=w@mail.gmail.com>
On Fri, 17 Apr 2015 06:39:29 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> % $(
> cmdsubst> [press ctrl-c here]
> zsh: parse error near `$('
>
> I would expect to not get an error message about syntax after pressing
> ctrl-c.
I think that means we can handle this case as part of a general tidy up
rather than agonising over the complexities of the nested parsing ---
which means we can reap the benefit [sorry, leverage the synergy] of
breaking out the interrupt flag. The following looks plausible, though
the interactions are complicated.
I believe the fix for only resetting the interrupt flag when resetting
the local keymap if there actually *was* a local keymap has to be
correct, but you never quite know if there are scary special cases that
use things differently...
pws
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index cfef882..c6fae25 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -503,8 +503,9 @@ selectkeymap(char *name, int fb)
mod_export void
selectlocalmap(Keymap m)
{
+ Keymap oldm = localkeymap;
localkeymap = m;
- if (!m)
+ if (oldm && !m)
{
/*
* No local keymap; so we are returning to the global map. If
diff --git a/Src/lex.c b/Src/lex.c
index 184a54b..c929bb9 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1558,10 +1558,12 @@ parsestr(char **s)
if ((err = parsestrnoerr(s))) {
untokenize(*s);
- if (err > 32 && err < 127)
- zerr("parse error near `%c'", err);
- else
- zerr("parse error");
+ if (!(errflag & ERRFLAG_INT)) {
+ if (err > 32 && err < 127)
+ zerr("parse error near `%c'", err);
+ else
+ zerr("parse error");
+ }
}
return err;
}
diff --git a/Src/parse.c b/Src/parse.c
index 0b54a90..91a81e1 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2419,7 +2419,7 @@ yyerror(int noerr)
for (t0 = 0; t0 != 20; t0++)
if (!t || !t[t0] || t[t0] == '\n')
break;
- if (!(histdone & HISTFLAG_NOEXEC)) {
+ if (!(histdone & HISTFLAG_NOEXEC) && !(errflag & ERRFLAG_INT)) {
if (t0 == 20)
zwarn("parse error near `%l...'", t, 20);
else if (t0)
next prev parent reply other threads:[~2015-04-17 9:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 4:39 broken parsing with $((`:`)) Mikael Magnusson
2015-04-17 9:16 ` Peter Stephenson [this message]
2015-04-17 10:52 ` PATCH: unwanted error aborting continued command substitution Mikael Magnusson
2015-04-17 11:02 ` Peter Stephenson
2015-04-17 15:46 ` Bart Schaefer
2015-04-17 16:31 ` 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=20150417101600.09a17a9e@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.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).