From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6847 invoked from network); 14 Apr 2002 05:07:58 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Apr 2002 05:07:58 -0000 Received: (qmail 15871 invoked by alias); 14 Apr 2002 05:07:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16980 Received: (qmail 15858 invoked from network); 14 Apr 2002 05:07:49 -0000 From: "Bart Schaefer" Message-Id: <1020414050308.ZM7620@candle.brasslantern.com> Date: Sun, 14 Apr 2002 05:03:08 +0000 In-Reply-To: <1018728981.6553.7.camel@localhost.localdomain> Comments: In reply to Borsenkow Andrej "problem with quoting in completion function" (Apr 14, 12:16am) References: <1018728981.6553.7.camel@localhost.localdomain> <1018729436.6553.13.camel@localhost.localdomain> In-Reply-To: <1018729436.6553.13.camel@localhost.localdomain> Comments: In reply to Borsenkow Andrej "Re: problem with quoting in completion function" (Apr 14, 12:23am) X-Mailer: Z-Mail (5.0.0 30July97) To: Borsenkow Andrej , Zsh hackers list Subject: Re: problem with quoting in completion function MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 14, 12:16am, Borsenkow Andrej wrote: } } I spent some time trying to understand why the following (suggested by } Sven) does not work: } } compset -P "*," } all_sources=( ${all_sources:#(${~IPREFIX//,/|})} ) On Apr 14, 12:23am, Borsenkow Andrej wrote: } } > It turned out, completion internally quotes IPREFIX, } } Of course it does not quote IPREFIX. It quotes word inserted in command } line that becomes IPREFIX on next try. } } Is there any general way inside completion to "dequote" word from } command line? I was going to compare this to Jeremy Dolan's bug from the other day, but after a bit of thought I see that it isn't, really -- the quoting of the IPREFIX theoretically shouldn't matter, because it's ignored, after all. I wonder if ${(Q)IPREFIX} would do what you need? What should happen if the ignored prefix contains e.g. an unmatched single-quote? Probably you should examine $compstate[all_quotes] to decide what to do. Here's a different example of Jeremy's bug: schaefer<512> ls "foo\ Completing corrections foo\!baz foo\!bar Completing original foo\\ Note that it thinks the original string has two backslashes, and only supplies the other two choices as corrections. In that case, the completion internals really did quote $PREFIX. It's already got both backslashes by the time _main_complete starts calling the completers. A quick peek at callcompfunc() shows that the prefix gets passed through multiquote() in all cases except math expressions. Again it might be possible to do something different depending on the quoting state, but in this case it'd have to be in the C code. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net