zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: Don't define internal params directly in hook function scope
Date: Thu, 30 Apr 2015 02:08:03 +0200	[thread overview]
Message-ID: <1430352483-30739-1-git-send-email-mikachu@gmail.com> (raw)
In-Reply-To: <CAHYJk3Q8gJWs=YKw7AtvqoyzGnn9Qbm2nFwLgzqBCnNwzmAQJQ@mail.gmail.com>

Something feels very wrong about this :). I'm not committing it.
(I didn't investigate this at all, it's just based on my observation that wrapping the local in an anonymous function helped, and this also works. It may blow up something).

---
 Src/Zle/compcore.c | 2 ++
 Src/Zle/zle_main.c | 7 ++++++-
 Src/Zle/zle_misc.c | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index f50c9e9..6816847 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -825,6 +825,7 @@ callcompfunc(char *s, char *fn)
 	comp_setunset(rset, (~rset & CP_ALLREALS),
 		      kset, (~kset & CP_ALLKEYS));
 	makezleparams(1);
+	startparamscope();
 	sfcontext = SFC_CWIDGET;
 	NEWHEAPS(compheap) {
 	    LinkList largs = NULL;
@@ -841,6 +842,7 @@ callcompfunc(char *s, char *fn)
 	} OLDHEAPS;
 	sfcontext = osc;
 	endparamscope();
+	endparamscope();
 	lastcmd = 0;
 	incompfunc = icf;
 
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index ef6a29d..71c7c24 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1383,12 +1383,14 @@ execzlefunc(Thingy func, char **args, int set_bindk)
 	    }
 	    startparamscope();
 	    makezleparams(0);
+	    startparamscope();
 	    sfcontext = SFC_WIDGET;
 	    opts[XTRACE] = 0;
 	    ret = doshfunc(shf, largs, 1);
 	    opts[XTRACE] = oxt;
 	    sfcontext = osc;
 	    endparamscope();
+	    endparamscope();
 	    lastcmd = 0;
 	    r = 1;
 	    redup(osi, 0);
@@ -1878,6 +1880,7 @@ zlebeforetrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
     if (zleactive) {
 	startparamscope();
 	makezleparams(1);
+	startparamscope();
     }
     return 0;
 }
@@ -1885,8 +1888,10 @@ zlebeforetrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
 static int
 zleaftertrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
 {
-    if (zleactive)
+    if (zleactive) {
+	endparamscope();
 	endparamscope();
+    }
 
     return 0;
 }
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 4669ef2..b4e9f0e 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -1609,10 +1609,12 @@ iremovesuffix(ZLE_INT_T c, int keep)
 
 	    startparamscope();
 	    makezleparams(0);
+	    startparamscope();
 	    sfcontext = SFC_COMPLETE;
 	    doshfunc(shfunc, args, 1);
 	    sfcontext = osc;
 	    endparamscope();
+	    endparamscope();
 
 	    if (wasmeta)
 		metafy_line();
-- 
2.2.0.GIT


  reply	other threads:[~2015-04-30  0:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  6:35 [BUG] Can't mark unset variables as read-only Martijn Dekker
2015-04-29 10:36 ` Peter Stephenson
2015-04-29 10:57   ` Mikael Magnusson
2015-04-29 11:01     ` Mikael Magnusson
2015-04-30  0:08       ` Mikael Magnusson [this message]
2015-04-30  4:01         ` PATCH: Don't define internal params directly in hook function scope Bart Schaefer
2015-04-30  8:44           ` Peter Stephenson
2015-04-30 11:18             ` Peter Stephenson
2015-04-29 11:09     ` Local readonly specials (was: Can't mark unset variables as read-only) Peter Stephenson
2015-04-29 13:46   ` [BUG] Can't mark unset variables as read-only Martijn Dekker
2015-04-29 13:55   ` Bart Schaefer
2015-04-29 14:41     ` Peter Stephenson
2015-04-29 15:33       ` Chet Ramey
2015-04-29 19:09         ` Stephane Chazelas
2015-04-29 23:22           ` Chet Ramey
2015-04-30  3:57         ` 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=1430352483-30739-1-git-send-email-mikachu@gmail.com \
    --to=mikachu@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).