Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Command expansion failure in for loops
- X-seq: zsh-workers 41280
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Mike Brown <brown@xxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Command expansion failure in for loops
- Date: Mon, 12 Jun 2017 19:38:50 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=qIasuxwcBWyvlwR776SfAai9B9oYiYCNc/JiSneeiqo=; b=g0qfcBckhr4v3dFFi1psXBTnQ4WaSaxQaSL7o3PREaNNcReAnALqlHimn5Cxn2vq9q rCoHugNGdV1OpRDQzzEuftphVq3P19q43cTTEjwPmP2HlU5kNDcjCHg8xRzR+cXS2YwP bEBGFdYo2XKT7DIMEXLl/S4E57T83aVSQH1WM4oxGxcjEqsAly9xeqarTBa3H/oZYAk3 NXmwO+5+SLW0KZBO71IVWpxgTRTM8mfWyTlp0b86nXhpqsaTBATh0q48z+R6dmdK0yUy 3rd19lfZ1Jki9OOSRtG9ROrdRM6TbBOPZQH6vn1KL+DrjnNj7LIW0XXlhpWq7DGhPcAb qNcg==
- In-reply-to: <20170613015058.GJ1003@mrvideo.vidiot.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170613015058.GJ1003@mrvideo.vidiot.com>
On Jun 12, 8:50pm, Mike Brown wrote:
}
} Now for the issue. Command expansion is no longer working in for loops.
This works if "compinit" has been run, but possibly for the wrong reason:
if there is a completion function defined, it is called so that it can
make the decision about whether to complete a word or insert a TAB (see
"usetab()" mention below).
It fails with "native" completion (compctl et al.).
} for name in x y z
} for> do
} for> ftp_s<TAB>
The reason appears to have something to do with workers/36025. When
complete-word is done on the same line as the "do" everything is fine;
it's only when on the new line after "do" that it gets confused. At
this test --
1189 lincmd = !inredir &&
1190 ((incmdpos && !ins && !incond) ||
1191 (oins == 2 && wordpos == 2) ||
1192 (ins == 3 && wordpos == 1) ||
1193 (cmdtok == NULLTOK && !incond));
-- when completing on the same line as "do", cmdtok == NULLTOK, but when
completing on the next line, cmdtok == FOR, and so lincmd becomes false
and command names are not completed (instead file names are).
I haven't tracked down why the lexical analysis changes with the extra
newline. Probably "do" isn't being treated as a reserved word, i.e.,
lexing thinks it is "for name in x y z do;" ?
There's one additional oddity, which is that with expand-or-complete
instead of complete-word, if the line following "do" is empty then
usetab() returns true and no completion is done at all; instead a TAB
is inserted. However, that's been that way since sometime in 4.x.
} It worked before version 5.2.
Broken for me as far back as zsh-5.0.2-dev-0 (so perhaps not directly
related to 36025 after all, but seems to be in that part of the code).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author