From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19721 invoked by alias); 7 Dec 2016 03:52:36 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40113 Received: (qmail 18509 invoked from network); 7 Dec 2016 03:52:36 -0000 X-Qmail-Scanner-Diagnostics: from nm32-vm9.bullet.mail.ir2.yahoo.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(212.82.97.105):SA:0(0.0/5.0):. Processed in 0.656116 secs); 07 Dec 2016 03:52:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.97.105 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1481082303; bh=p7bagyb8umaBM8utZAA6e7xoWEvMUFcQDm8Y9pmcU+Q=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=e5qlXpa8yUWoPuZW6YqSoLqlgUpnLGtNz3R6mkSnBwlB4JX/XPHPDRc0OJAOM6Ap6d/DrLW0p1NLqwOWXx7IWIG7c2T7Hz46u6mizJrLT0sSEfO5kqeUV74fVJR8CazVBVpha+QBqvAYUeEoWznhNtvdhEWsKbXT4MDjoqixYTKq1dF6AOhFGCEBtF972xil9BRfHufuUc0ANzEIrHPQgugpt3YDlqeHUYBZoxcedb64phWAfigZdWOmYjFlTA0v3eR7GYCMmw7lH28PFXh6gPV24x5F9ivSNPNRzvRYqpwYst2L3mea47dThmRjoy/1odrDuZLM/oDg7KJwc/KqhA== X-Yahoo-Newman-Id: 597612.52784.bm@smtp149.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 0ShjiS0VM1mkpWgXNzdL0M3wfHuLjLCvMH.yyy_3N93SHKE W.MxV5WiP7uhx5OFLwR0w7SMuHBYG95mwLX_0i0cbQf.JRpnZGzZ9dvxPtw5 W2v695V.j2ZR7s1G4.od4nd3yQYjTHCMY_ZY6UZDCTmAoFu63LoBhFZx9jzW qpVEaCsMxvy9lomazyLGUxVk0ZWqK9ekge58W.8ihx.4iVyoa2mp3kLQRRYh qVj9yVT9w8K6zFryzn32srbGM07e_KA6mTPUdAPAhabMkl7DqXUMSULOcu66 5bpb9uQhURfJXjCkHtiKCdbvu09fc3aK8cTNmA__7hJMeVWxc9Z.h4.GL5qS qVl4XHUviXwhI50PK_aBAPXbuzHItb8O0lnzYeMlrJDqG_SpX2Bqik0IdpF9 EAGzz6B6C4SCtPr0kBMyugiCo8TmtXk4SFYBRv12IyHjrMGeaHLykI7eeTEa 9ibvTUlgzXqYBF9YlysHd4deqeCvfgNRn6c7p_FfDZKmMID2EDSPiw9wxZ1R 5h3Q3JOFYYPwtW1O8hzerVzMDtXNTpAMrSuq96S7N X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <161206132136.ZM31929@torch.brasslantern.com> From: Oliver Kiddle References: <20161206142754.GA12824@cventin.lip.ens-lyon.fr> <161206085722.ZM31320@torch.brasslantern.com> <67542.1481045399@hydra.kiddle.eu> <161206132136.ZM31929@torch.brasslantern.com> To: zsh-workers@zsh.org Subject: Re: completion files sensitive to user options like RC_QUOTES MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <93887.1481082302.1@hydra.kiddle.eu> Content-Transfer-Encoding: 8bit Date: Wed, 07 Dec 2016 04:45:02 +0100 Message-ID: <93888.1481082302@hydra.kiddle.eu> Bart wrote: > There would be a case for wrapping the "eval" expressions in _expand > with temporary restoration of $_comp_caller_options, because of the > effects of NO_ksharrays etc. There might be a few other similar > situations. Yes: var=yyyyy setopt histsubstpattern : ${var:s/y*/X} → yyyyy Similar problems for kshglob, norcexpandparam and others For csh_junkie_quotes, it looks like the completion internals aren't handling it anyway. To restore $_comp_caller_options it is still best to limit the range of options. Is there a simple way to restore it for that matter, best I can come up with is the following which ends up duplicating the selection of options. optkeys=( ${(k)options[(I)(${(@~j.|.)_comp_options#NO_})]} ) set ${${${(v)options[(I)(${(@~j.|.)_comp_options#NO_})]:/on/-o}:/off/+o}:^optkeys} > We have the "sticky emulation" mechanism. Entry to completion could > save the current option state before invoking the user-defined code, > and then compadd could temporarily revert to that saved state. Internally to the C code it needn't really use the sticky emulation feature. Judging from a grep of the source, there's about a dozen options that should perhaps have their values saved on entry to the completion widgets with the code then checking those saved values instead of the current state. > On a side note, maybe we need a special keyword for "emulate" that > means "make sticky whatever the current options are" -- right now > you would have to spell that out explicitly, relative to some base > emulation such as zsh or sh. How about some way to create a custom emulation. So _main_complete does something like: emulate -C _useropts Then, wherever we need to, we can use sticky emulation to get the user's setup: emulate _useropts -c 'var=( $expn )' Is a pity we have to quote everything to -c. The first feature could use current options as the default base but allow something like: emulate -C bash sh -o kshglob +o shglob -o braceexpand Oliver