From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28902 invoked by alias); 2 Feb 2016 17:48:27 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21225 Received: (qmail 1382 invoked from network); 2 Feb 2016 17:48:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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:content-type; bh=n8vkYfH7j3GqvHTv+yQF8Y2iO6wEIHVeOKMVfaUiAKI=; b=q4UzTyng4aunbJuoYBz5zKG2kwp/TQcQ+I/8COHqn3zEPEwOXpio5o8rcCtYQZsx5G OEvP5r98X5g67FimNJx7wz8sB0SPX3tryUt2FmDVeft7bdp5WdQ5J89g2ZvascvwF828 DtNraNhiIK+XVGkGn4bPEx2pJZpLlmKQwQIGpO58KShcb+/Y9ZNows7krWMGbfh0IYDQ f7VezS/I1mxeHCxVM5NP7x1Us6DM8Gp6qd11u2KgKUqeC9FFvy9OM3q8dElxQU53Zxku rQ9ED9eLcpjkxxTStUJDro4zkzYzaGNIjUBV6N/H6FndApg25/BWXzGTJf7dX9sAlnX7 WDBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=n8vkYfH7j3GqvHTv+yQF8Y2iO6wEIHVeOKMVfaUiAKI=; b=e5YxVWyiT77dvxzODP2WLBcfE1Pab9ZYL56oS2FTOLFRBTZ7FeealSOpDEQjy5huIj DEO+jbVxHgauLEjnapDtsqbdiYieGs8CgmJMpW5fKaPi1rNAIN8d8oKnINt/3l8V439C qKw5RG0g1O2FTJR1TPN7GKp+N4UCwoDrJy872NW4JIygg15b3L5hshO2gOyZownj/04M WeFYi7Ev5gN8AOq0U/ZQLEBUD/Cc0OPOIltTSfApfNlj7ynTTnkOU3ekIxAYu2La7tW1 MJ2LdyyeQuFxAx1CIQaGenUCeJyftvA4nRXrbPMYjJ4pt3Po3c1UbuYP2+IDSCBOSQWt Sg3g== X-Gm-Message-State: AG10YORxYz5cx5UPr40eeTfDp2v9rTZuwobUwYHGEza7MpYerJ/u+LuYif2mKeniiPIpig== X-Received: by 10.98.72.133 with SMTP id q5mr7194124pfi.166.1454435301690; Tue, 02 Feb 2016 09:48:21 -0800 (PST) From: Bart Schaefer Message-Id: <160202094916.ZM1118@torch.brasslantern.com> Date: Tue, 2 Feb 2016 09:49:16 -0800 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Color in completions" (Feb 2, 12:21pm) References: <160129144546.ZM24675@torch.brasslantern.com> <160131093929.ZM11508@torch.brasslantern.com> <160201065310.ZM29704@torch.brasslantern.com> <160201133104.ZM30504@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Color in completions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 2, 12:21pm, Sebastian Gniazdowski wrote: } Subject: Re: Color in completions } } > Hmm, I get (after editing _zplugin to add -C): } > } > burner% zplg } > tags in context :completion::complete:zplg:: } > argument-1 (_arguments _zplugin) } > tags in context :completion::complete:zplg:argument-1: } > commands (_zplugin) } } The "zplg" is weird. Sorry, my bad. Some other stuff I was fooling with leaked in. This is the effect of the COMPLETE_ALIASES option: burner% setopt completealiases burner% zpl tags in context :completion::complete:zpl:: argument-1 (_arguments _zplugin) tags in context :completion::complete:zpl:argument-1: commands (_zplugin) If I make sure completaliases is off, then without -C/curcontext I get: burner% zplg tags in context :completion::complete:zplugin:: argument-1 (_arguments _zplugin) (note no "commands") and with -C/curcontext I get: burner% zplg tags in context :completion::complete:zplugin:: argument-1 (_arguments _zplugin) tags in context :completion::complete:zplugin:argument-1: commands (_zplugin) } Again to compare what I have: } } % zplg } tags in context :completion::complete:zplugin:: } argument-1 (_arguments _zplugin) } commands (_describe _zplugin) The difference must be with zstyle, e.g., the completer style -- I am (now that I got rid of completealiases) testing with the absolute minimum setup after "zsh -f" so I have only one zstyle: burner% zstyle -L zstyle ':completion:*:zplugin:*:argument-rest' list-colors '=(#b)(*)/(*)==1;35=1;33' burner% } When I add -C to _arguments (btw, when to use -C?): Doc: The option -C tells _arguments to modify the curcontext parameter for an action of the form `->STATE'. This is the standard parameter used to keep track of the current context. Here it (and not the context array) should be made local to the calling function to avoid passing back the modified value and should be initialised to the current value at the start of the function: local curcontext="$curcontext" This is useful where it is not possible for multiple states to be valid together. As I understand this, the point of -C is to create distinct zstyle contexts for different ->state targets, so that the context can be referenced in the caller of _arguments (and otherwise downstream) after _arguments has returned. So e.g. in _zplugin, in the "case $state" block, when _wanted is called it sees the context set by _arguments -C instead of the context in which _zplugin started. } What zstyle would you do to handle zpl, zplg aliases? I could provide } multiple Zstyles so that no user will be left without colors. I'm not sure what you mean by this -- normally you would provide only the tag names, it's up to the user to decide on the context. If you mean what settings you should suggest, you could try: zstyle ':completion:*:zpl*:*:argument-rest' list-colors ... } > Your #mark style is more specific than my suggestion. That means it } > matches neither the argument-1 tag nor the command and plugins tags. } } I wish I could understand all this better. Zstyles are a little weird because they're backwards from typical usage. Normally the user would supply a fixed string and the code would have a pattern that it compared. With zstyle, the code has the fixed (though incrementally constructed) string [the context] and the user supplies the pattern, so that the same style can apply to multiple contexts. So for completion the more colons and fewer wildcards that appear in the user's zstyle commands, the more specifically those settings apply. (It's potentially important to remember that the colons are specific to the use of zstyle in compsys and have no special significance to the internals of the zstyle command.) -- Barton E. Schaefer