From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16302 invoked by alias); 3 Mar 2013 06:10:24 -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: 31099 Received: (qmail 10608 invoked from network); 3 Mar 2013 06:10:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130302220953.ZM12070@torch.brasslantern.com> Date: Sat, 02 Mar 2013 22:09:53 -0800 In-reply-to: <130228215632.ZM9327@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: trying to understand how the zsh completer works" (Feb 28, 9:56pm) References: <130228215632.ZM9327@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: trying to understand how the zsh completer works MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 28, 9:56pm, Bart Schaefer wrote: } } In retrospect it might have been useful to split the context analysis } from the generation of matches, rather than having a single function } responsible for doing both parts for each command name. } } The only workaround for this is to do your own context analysis and } embed that in the style value via "zstyle -e". ... I had a mildy crazy idea that it should be possible to modify the algorithm from _complete_help to create a function that could be called from zstyle -e for the completer style. This function would intuit the contexts that would be used later when the completers themselves were the callers, thereby allowing the list of completers to be modified for the contexts they hadn't "really" created yet. After working out some fairly convoluted recursion issues -- because the completer style is being looked up in _main_complete, and then the style evaluation wants to call _main_complete again to simulate what the surrounding call in progess is going to do later -- I came up with an example that generates all the deep contexts and successfully looks up the value for the completer style in each of them. Unfortunately, it still doesn't work, because to find the single most specific context out of all the possible matching zstyle patterns is equivalent to the zstyle internal algorithm for ordering patterns by increasing specificity. The simple ${(ok)...} used by _complete_help is the wrong order nearly all the time. If the preceding paragraph made sense to you, and you feel inclined to implement order-by-context-specificity in _complete_help to replace ${(@ok)help_sfuncs} at around line 58, let me know what you come up with. Otherwise I may eventually get there.