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

Re: Strange function/pipestatus behavior, maybe a scope bug?



On Thu, 24 Oct 2013 16:48:29 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> There is some bad interaction with completion, at least on my setup
> (happens from a vanilla setup, too):
> 
> % true | true | false
> % print $pipest<TAB>
> 0
> 
> This doesn't seem to happen with hooks, so completion is failing to save
> something it should.

Hmm... does the following have any bad effects?  If we're really only
after the return value of the function, I don't think it should...

diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 39d41bd..5c5628a 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -826,7 +826,6 @@ callcompfunc(char *s, char *fn)
 	sfcontext = SFC_CWIDGET;
 	NEWHEAPS(compheap) {
 	    LinkList largs = NULL;
-	    int olv = lastval;
 
 	    if (*cfargs) {
 		char **p = cfargs;
@@ -836,9 +835,7 @@ callcompfunc(char *s, char *fn)
 		while (*p)
 		    addlinknode(largs, dupstring(*p++));
 	    }
-	    doshfunc(shfunc, largs, 0);
-	    cfret = lastval;
-	    lastval = olv;
+	    cfret = doshfunc(shfunc, largs, 1);
 	} OLDHEAPS;
 	sfcontext = osc;
 	endparamscope();

pws



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