Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: incorrect setopt completion
- X-seq: zsh-workers 36177
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: incorrect setopt completion
- Date: Sat, 15 Aug 2015 03:02:45 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7SDa18KnEnPoD9ZZ62bov1ocJaCZ1KrmX2cgGR2GJNw=; b=CfhftH/3mCZLQDbMStYyJCaLgfJ7qm+8ZNHwmz6a54qDOyFGTh8JH1nCzv5iNARKGG cSQiXE+MdfoVMtgODYukAEB/5TMzvww4Mf5w0PERyjxAey0BSFIMZPLUh5kQdzotYfeL lzna3OQMt48SpM5aOXQknlyRmJQ30LmueIsFBYFQGquHqvHbaae4GsIX0l8TACuhHjpA haB4YPLxqj4nf1iK3pMb8hPaATXY4QZTZ2XW2VybLdFk9wHrpqTOq5vM5A5WtU1hi76f 4PP+g1fV325hDj19rywffRvqURQ4Q9VOQkJk/Gu251DknRDPZ8TvWPutI7jj+hycUsNh wlIw==
- In-reply-to: <20150815000543.GA2043@zira.vinc17.org>
- 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: <20150815000543.GA2043@zira.vinc17.org>
On Sat, Aug 15, 2015 at 2:05 AM, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> With zsh 5.0.8, I have:
>
> zira:~> setopt | grep print
> printexitvalue
>
> "setopt nopri[TAB]" and "unsetopt pri[TAB]" don't give any completion.
> However "setopt pri[TAB]" has printexitvalue among its completions.
> This should be the opposite!
The completion system takes care to store a backup of $options before
setting $_comp_options, however, the C code does this when calling any
sh function:
opts[PRINTEXITVALUE] = 0;
So, I guess _setopt will just have to always complete printexitvalues
both ways around.
% setopt | grep 'combiningchars\|printexitvalue'
combiningchars
printexitvalue
% source =(echo 'setopt | grep ''combiningchars\|printexitvalue''')
combiningchars
printexitvalue
% () setopt | grep 'combiningchars\|printexitvalue'
combiningchars
If anyone is very bored, they could make a separate variable that gets
checked instead of / in addition to isset(PRINTEXITVALUE) in relevant
places, and leave the value of the option alone, but for now I'll just
do this.
diff --git i/Completion/Zsh/Command/_setopt w/Completion/Zsh/Command/_setopt
index fb38d1d..86c0965 100644
--- i/Completion/Zsh/Command/_setopt
+++ w/Completion/Zsh/Command/_setopt
@@ -2,8 +2,9 @@
local expl ret=1
local -a onopts offopts
-onopts=( ${(k)_comp_caller_options[(R)on]} )
-offopts=( ${(k)_comp_caller_options[(R)off]} )
+onopts=( ${(k)_comp_caller_options[(R)on]} printexitvalue )
+offopts=( ${(k)_comp_caller_options[(R)off]} printexitvalue )
+typeset -U onopts offopts
case $service in
setopt) onopts=(no$onopts) ;;
unsetopt) offopts=(no$offopts) ;;
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author