zsh-workers
 help / color / mirror / code / Atom feed
* Disable special-dirs for cdpath
@ 2011-10-08 10:58 Mikael Magnusson
  2011-10-09 17:40 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2011-10-08 10:58 UTC (permalink / raw)
  To: zsh workers

Hi,

% .<tab>
---- local directory
../    .git/
---- directory in cdpath
../

This annoyed me a bit, and it doesn't seem possible to use
'path-directories' in the look up for the special-dirs style, it
always uses "paths" as the tag. I came up with this, but it hardly
seems like the right way to do it,

--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -180,7 +180,8 @@ else
   skips='((.|..)/)##'
 fi

-zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs
+zstyle -s ":completion:${curcontext}:${mopts[$((1+${mopts[(i)-J]}))]}"
special-dirs sdirs || \
+  zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs
 zstyle -t ":completion:${curcontext}:paths" list-suffixes &&
     listsfx=yes

Any other ideas? Is the "real" tag already accessible here in some
other parameter?

-- 
Mikael Magnusson


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

* Re: Disable special-dirs for cdpath
  2011-10-08 10:58 Disable special-dirs for cdpath Mikael Magnusson
@ 2011-10-09 17:40 ` Peter Stephenson
  2011-10-09 17:52   ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2011-10-09 17:40 UTC (permalink / raw)
  To: zsh workers

On Sat, 8 Oct 2011 12:58:26 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> Any other ideas? Is the "real" tag already accessible here in some
> other parameter?

You'd have thought so, wouldn't you?  The completion code is looping
over the tags, it ought to be easy to work out what tag you've got and
use it (or, if it isn't, that you haven't got a tag, so you use a
default one, in this case paths).

However, this quickly turns into "I'm sorry I even thought about
looking" territory.  Buried under the tag handling completion functions,
which are documented but only tell you how the looping works, are the
builtins comptags and comptry within the famously undocumented source
code of zsh/computil, and the published API documentation reads, in
full,

       comptags
       comptry
              These implement the internals of the tags mechanism.

So this looks like another of those things that will have to become
someone's life's passion to investigate, document, and render
maintainable.

-- 
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: Disable special-dirs for cdpath
  2011-10-09 17:40 ` Peter Stephenson
@ 2011-10-09 17:52   ` Mikael Magnusson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2011-10-09 17:52 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh workers

On 9 October 2011 19:40, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Sat, 8 Oct 2011 12:58:26 +0200
> Mikael Magnusson <mikachu@gmail.com> wrote:
>> Any other ideas? Is the "real" tag already accessible here in some
>> other parameter?
>
> You'd have thought so, wouldn't you?  The completion code is looping
> over the tags, it ought to be easy to work out what tag you've got and
> use it (or, if it isn't, that you haven't got a tag, so you use a
> default one, in this case paths).
>
> However, this quickly turns into "I'm sorry I even thought about
> looking" territory.  Buried under the tag handling completion functions,
> which are documented but only tell you how the looping works, are the
> builtins comptags and comptry within the famously undocumented source
> code of zsh/computil, and the published API documentation reads, in
> full,
>
>       comptags
>       comptry
>              These implement the internals of the tags mechanism.
>
> So this looks like another of those things that will have to become
> someone's life's passion to investigate, document, and render
> maintainable.

Ah, thanks for looking, and sorry for making you :). I'll just keep my
silly hack for now.

-- 
Mikael Magnusson


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

end of thread, other threads:[~2011-10-09 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-08 10:58 Disable special-dirs for cdpath Mikael Magnusson
2011-10-09 17:40 ` Peter Stephenson
2011-10-09 17:52   ` Mikael Magnusson

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