zsh-workers
 help / color / mirror / code / Atom feed
* Re: wish for a colored completion system
       [not found] <200006081449.QAA21570@beta.informatik.hu-berlin.de>
@ 2000-06-08 16:02 ` Peter Stephenson
  2000-06-08 17:40   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2000-06-08 16:02 UTC (permalink / raw)
  To: Zsh hackers list

> It's the normal way of configuring things for the new completion
> system and I definitely think colouring should be done like all other
> setup for it. The `=pat=col' syntax was partly chosen because we
> (well, some people here) wanted the possibility to use their $LS_COLOR
> for zsh, too. That left us not too many syntax extensions to use.

It's perfectly possible to write a front-end to compile styles, though,
which you give command names, colours, patterns, etc., and which produces
the zstyle command.  It's not really suitable for sticking in compinstall
at the moment since it needs quite a lot of work to handle non-default
contexts in a natural way.  You can specify a context at the moment, but
it's a bit bemusing for the average user who hasn't spent their weekends
wading through the manual, and it would be better to make it easier to
change the context from within the normal menu hierarchy rather than going
back to the top level each time.  Plus it ought to be called
`compconfigure', but there were things of that nature at the time.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: wish for a colored completion system
  2000-06-08 16:02 ` wish for a colored completion system Peter Stephenson
@ 2000-06-08 17:40   ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-06-08 17:40 UTC (permalink / raw)
  To: Zsh hackers list

On Jun 8,  5:02pm, Peter Stephenson wrote:
}
} It's perfectly possible to write a front-end to compile styles, though,
} which you give command names, colours, patterns, etc., and which produces
} the zstyle command.

Yes, I was thinking about that; it'd also be nice to document somewhere
the mapping from numbers to colors.  I realize we haven't done so because
it's defined in some other standard, but it seems to be relatively stable
so maybe we should at least mention that `dircolors --print-database` is
usually the way to find out (at least if you have GNU stuff around).

-- 
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   


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

* Re: wish for a colored completion system
@ 2000-06-13  9:25 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2000-06-13  9:25 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Jun 9,  9:24am, Sven Wischnowsky wrote:
> } Subject: Re: wish for a colored completion system
> }
> } Bart Schaefer wrote:
> } 
> } > I'm not sure why ':completion:*:ssh:*' doesn't work for the combined
> } > listing; perhaps it's a bug.  Sven?
> } 
> } Hm, yes, the description in the docs make it sound as if it should
> } work. The problem is that without separate groups there is no way for
> } the completion code to find out that with
> } 
> }   zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
> }   zstyle ':completion:*:ssh:*:users' list-colors '=b*=32'
> } 
> } hosts starting with `b' should be coloured with `32'. We would need a
> } per-match colouring for that and that's too expensive.
> 
> I think you misunderstood my question.  I didn't ask why
> 
>     zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
> 
> doesn't work.  I asked why
> 
>     zstyle ':completion:*:ssh:*' list-colors '=a*=31'
> 
> doesn't work.  There isn't any group involved there at all; I don't ask
> for the hosts to be colored separately from the users; I just ask for
> anything that happens to be there (and that begins with `a') to work.
> But it doesn't, unless I set group-name ''.

;-) I understood that -- and noticed that the part you quoted doesn't
answer the question. That's why the next paragraph started the way it
did:

> And to come back to the question, the completion code only looks up
> the style with the tag in the context and it can't find out that the
> pattern used in the definition doesn't contain the tag. If we wanted
> to solve that, we would have to make _setup get the name of the group
> (which may be -default-) as an argument (when called from
> _description) and use that name in ZLS_COLORS. But then we would be
> back to what I said above.
> 
> So, we could (quite easily) change it, but that set-for-one-tag-and-
> used-for-others-too made me do it in the way we have it now, I would
> be willing to write the change if people say that they prefer it,
> though (I have group-name == '', so I don't care much about this).

I.e. _setup just uses the tag in ZLS_COLORS, as you've seen. To get
this right, we would shouldn't just make the colors be (almost) always 
used (11847) because that works only for functions using the
argument-* tags. Probably even more confusing.

The problem is really that the code in _setup can't find out what
pattern was used when defining the style. It should use the value for
`...:*:ssh:*' everywhere but it should use the one defined for
`:...:*:ssh:*:hosts' only for names of hosts. But since complist only
distinguishes between groups (and it can only do that), a setting for
the latter pattern would be used for usernames, too, if they are in
the same group and we change the calls to _setup as I suggested (and
then make it use that group name when adding things to ZSL_COLORS, of
course).

Hrm, maybe we should admit this and use the group name instead of the
tag when looking up list-colors.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: wish for a colored completion system
  2000-06-10  3:34 ` Bart Schaefer
@ 2000-06-10  4:38   ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-06-10  4:38 UTC (permalink / raw)
  To: zsh-workers

On Jun 10,  3:34am, Bart Schaefer wrote:
} Subject: Re: wish for a colored completion system
}
} I asked why
} 
}     zstyle ':completion:*:ssh:*' list-colors '=a*=31'
} 
} doesn't work.

The following does something more like I would expect, but I won't commit
it because I'm sure I've missed something.

Index: Completion/Core/_setup
===================================================================
@@ -4,7 +4,7 @@
 
 if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
   zmodload -i zsh/complist
-  if [[ "$1" = default ]]; then
+  if [[ "$1" = (default|(|*-)argument-*) ]]; then
     ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
   else
     eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\""

-- 
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   


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

* Re: wish for a colored completion system
       [not found] <200006090724.JAA13449@beta.informatik.hu-berlin.de>
@ 2000-06-10  3:34 ` Bart Schaefer
  2000-06-10  4:38   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2000-06-10  3:34 UTC (permalink / raw)
  To: zsh-workers

On Jun 9,  9:24am, Sven Wischnowsky wrote:
} Subject: Re: wish for a colored completion system
}
} Bart Schaefer wrote:
} 
} > I'm not sure why ':completion:*:ssh:*' doesn't work for the combined
} > listing; perhaps it's a bug.  Sven?
} 
} Hm, yes, the description in the docs make it sound as if it should
} work. The problem is that without separate groups there is no way for
} the completion code to find out that with
} 
}   zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
}   zstyle ':completion:*:ssh:*:users' list-colors '=b*=32'
} 
} hosts starting with `b' should be coloured with `32'. We would need a
} per-match colouring for that and that's too expensive.

I think you misunderstood my question.  I didn't ask why

    zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'

doesn't work.  I asked why

    zstyle ':completion:*:ssh:*' list-colors '=a*=31'

doesn't work.  There isn't any group involved there at all; I don't ask
for the hosts to be colored separately from the users; I just ask for
anything that happens to be there (and that begins with `a') to work.
But it doesn't, unless I set group-name ''.

-- 
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   


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

end of thread, other threads:[~2000-06-13 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200006081449.QAA21570@beta.informatik.hu-berlin.de>
2000-06-08 16:02 ` wish for a colored completion system Peter Stephenson
2000-06-08 17:40   ` Bart Schaefer
     [not found] <200006090724.JAA13449@beta.informatik.hu-berlin.de>
2000-06-10  3:34 ` Bart Schaefer
2000-06-10  4:38   ` Bart Schaefer
2000-06-13  9:25 Sven Wischnowsky

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).