zsh-users
 help / color / mirror / code / Atom feed
* rake completion with colons in their names
@ 2012-04-21 12:55 Benoit Daloze
  2012-04-21 20:55 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Benoit Daloze @ 2012-04-21 12:55 UTC (permalink / raw)
  To: zsh-users

Hello,

I've observed rake completion does not work fully with nested rake
tasks (having a namespace and being in the form "namespace:task").

This has already been reported in
zsh-workers 22600: http://www.zsh.org/mla/workers/2006/msg00475.html
and Debian #379942: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=379942

The generation part was fixed, but not the matching part.

Nikolai Weibull says "Adding 'r:|[:]=*' to ones matcher-list makes it
work, but should this really be necessary?".

Indeed, adding that to the matcher-list works for me, but I guess it's
not ideal to modify that global list.

I found a workaround in the zshcompsys manual at tag-order:
"Another use of patterns is to try multiple match specifications one
after another.  The matcher-list style offers something similar, but
it is tested very early in the completion system and hence can't be
set for single commands nor for more specific contexts."

  zstyle ':completion:*:*:rake:*' tag-order '*' '*:-colon'
  zstyle ':completion:*-colon' matcher 'r:|[:]=*'

Could someone confirm this is appropriate?

And if so, could it be added to zsh (or be documented)?

Cheers,
Benoit Daloze


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rake completion with colons in their names
  2012-04-21 12:55 rake completion with colons in their names Benoit Daloze
@ 2012-04-21 20:55 ` Peter Stephenson
       [not found]   ` <CANLTa0A+HBzmPJ5Bzhc3d9sH=x0bXE1zax8Qy-HsFq_Kp+Fzgw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2012-04-21 20:55 UTC (permalink / raw)
  To: zsh-users

On Sat, 21 Apr 2012 14:55:49 +0200
Benoit Daloze <eregontp@gmail.com> wrote:
> I've observed rake completion does not work fully with nested rake
> tasks (having a namespace and being in the form "namespace:task").

If I've followed the chain of references properly, the problem is that
"namespace" gets completed, but not "namespace:task", even if the colon
is already present.

> Nikolai Weibull says "Adding 'r:|[:]=*' to ones matcher-list makes it
> work, but should this really be necessary?".

No, it shouldn't, no other zsh completion requires a matcher to be
set in order to perform the basic completion *at all*.  Usually you
would only require a special matcher if you want to extend the way the
completion can be done or extend the things it will match against.
(Allowing you to complete nam:ta to namespace:task would be a valid use
of a matcher.)

I would guess no one is putting much effort into maintaining _rake (I
myself use Ruby but not Rails).  It might be sensible to turn that
target completion into a separate function as a first step to make it
clearer what's going on.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rake completion with colons in their names
       [not found]   ` <CANLTa0A+HBzmPJ5Bzhc3d9sH=x0bXE1zax8Qy-HsFq_Kp+Fzgw@mail.gmail.com>
@ 2012-04-22 18:05     ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2012-04-22 18:05 UTC (permalink / raw)
  To: Zsh Users

On Sun, 22 Apr 2012 16:50:03 +0200
Benoit Daloze <eregontp@gmail.com> wrote:
> > It might be sensible to turn that target completion into a separate
> > function as a first step to make it clearer what's going on.
> 
> How would you do that? Do you mean wrapping it in a function?

No, I mean turning this rather baroque expression that creates the array
"target" (and that I can't follow as it stands without detailed
investigation):

${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}}

into a function that assembles the completion.  That might at least make
it obvious what's going on.

However, it might be worth seeing if replacing _describe as the function
to add the completions (just below that expression) helps.  _describe
treats colons specially, and although the colons are being quoted with
backslashes in the expression above, I wouldn't be 100% sure this
actually has the right effect.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-22 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 12:55 rake completion with colons in their names Benoit Daloze
2012-04-21 20:55 ` Peter Stephenson
     [not found]   ` <CANLTa0A+HBzmPJ5Bzhc3d9sH=x0bXE1zax8Qy-HsFq_Kp+Fzgw@mail.gmail.com>
2012-04-22 18:05     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).