Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Disable WARN_CREATE_GLOBAL in 'zstyle -e' code



[...]
>  c) Disable `warn_create_global' in code executed by "zstyle -e". Or
>     make `reply' and `REPLY' special in that case. Or whatever makes the
>     most sense.
>
> This patch does what "a)" suggests, basically because it works and I was
> lazy. I think "c)" would be the cleanest solution, but I don't know if
> that's doable and I haven't looked at the involved code yet.
[...]

This does "c)". I think this shouldn't break anything. So, I think it's
correct and should be preferable to setting NO_warn_create_global in
vcs_info.

Regards, Frank
---
 Src/Modules/zutil.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 698b7e3..2d8c61a 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -340,15 +340,22 @@ static char **
 evalstyle(Stypat p)
 {
     int ef = errflag;
+    int reset = 0;
     char **ret, *str;
 
     unsetparam("reply");
+    if (isset(WARNCREATEGLOBAL)) {
+        reset = 1;
+        dosetopt(WARNCREATEGLOBAL, 0, 0);
+    }
     execode(p->eval, 1, 0);
     if (errflag) {
 	errflag = ef;
 	return NULL;
     }
     errflag = ef;
+    if (reset)
+        dosetopt(WARNCREATEGLOBAL, 1, 0);
 
     queue_signals();
     if ((ret = getaparam("reply")))
-- 
1.7.0



Messages sorted by: Reverse Date, Date, Thread, Author