zsh-users
 help / color / mirror / code / Atom feed
* Problem with fake-files style and cd
@ 2009-02-14 14:22 ` Mikael Magnusson
  2009-02-14 18:01   ` Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-14 14:22 UTC (permalink / raw)
  To: zsh-users

Hi,

I want to complete foo/ in ~, and when I do this
zstyle ':completion::complete:cd::' fake-files $HOME:foo
I get the completion without the trailing /, if I do
zstyle ':completion::complete:cd::' fake-files $HOME:foo/
I get a trailing slash _and_ a trailing space. Is there a bug or did I
miss something obvious? When I don't get the slash I don't get a space
either.

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 14:22 ` Problem with fake-files style and cd Mikael Magnusson
@ 2009-02-14 18:01   ` Peter Stephenson
  2009-02-14 18:19     ` Mikael Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Stephenson @ 2009-02-14 18:01 UTC (permalink / raw)
  To: zsh-users

Mikael Magnusson wrote:
> I want to complete foo/ in ~, and when I do this
> zstyle ':completion::complete:cd::' fake-files $HOME:foo
> I get the completion without the trailing /, if I do
> zstyle ':completion::complete:cd::' fake-files $HOME:foo/
> I get a trailing slash _and_ a trailing space. Is there a bug or did I
> miss something obvious? When I don't get the slash I don't get a space
> either.

It's not really a bug, no.  fake-files isn't handled by _cd, it's
handled by _path_files, in other words it's a generic adder of fake
files; it has never tried to guess the context in which the file is
being added, nor is it documented to do so.  So it can't know that when
you add a fake file "foo" it's a directory.  Since it's a generic fake
*file*, there's nothing special about adding a slash, it just adds the
full match; and since it's a generic *fake* file it can't test what's
there to see how to handle it.  (There's some support for things that
spring into existence when referenced; is that not the case here?  If it
is this might be a bug but I'm not going to be able to look at it on my
system.)

I can see it would be convenient to add special support for a "/" at the
end of fake files along the lines of your second attempt; however, there
is no simple, elegant, bug-free way of adding anything to _path_files
(you're lucky if you get one of the three).  In this case I couldn't see
anything better than horribly ad-hoc tricks along the lines of "if you
get a single match at this point in the file and it's got a slash at the
end then remove the slash and add it again as a removable suffix".
It's probably doable, but horribly ad-hoc tricks usually don't fit into
any of the three categories above.

Users are encouraged to look at _path_files for themselves as an
exercise.

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


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

* Re: Problem with fake-files style and cd
  2009-02-14 18:01   ` Peter Stephenson
@ 2009-02-14 18:19     ` Mikael Magnusson
  2009-02-14 19:13       ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-14 18:19 UTC (permalink / raw)
  To: zsh-users

2009/2/14 Peter Stephenson <p.w.stephenson@ntlworld.com>:
> Mikael Magnusson wrote:
>> I want to complete foo/ in ~, and when I do this
>> zstyle ':completion::complete:cd::' fake-files $HOME:foo
>> I get the completion without the trailing /, if I do
>> zstyle ':completion::complete:cd::' fake-files $HOME:foo/
>> I get a trailing slash _and_ a trailing space. Is there a bug or did I
>> miss something obvious? When I don't get the slash I don't get a space
>> either.
>
> It's not really a bug, no.  fake-files isn't handled by _cd, it's
> handled by _path_files, in other words it's a generic adder of fake
> files; it has never tried to guess the context in which the file is
> being added, nor is it documented to do so.  So it can't know that when
> you add a fake file "foo" it's a directory.  Since it's a generic fake
> *file*, there's nothing special about adding a slash, it just adds the
> full match; and since it's a generic *fake* file it can't test what's
> there to see how to handle it.  (There's some support for things that
> spring into existence when referenced; is that not the case here?  If it
> is this might be a bug but I'm not going to be able to look at it on my
> system.)

(No, I've modified the _cd completer a bit to only add $cdpath things
if the first component is already typed out, because when I'm sitting
in a dir with only one subdir and type cd <tab> i would like that
directory completed and not the 50 ones in my cdpath. I used to have a
~/code symlink to point to where my code dir really is, and both ~ and
that dir is in my $cdpath. This causes listings of this type though:
% cd code/<tab>
---- local directory
zsh/
---- directory in cdpath
zsh/

and this was mostly a feeble attempt to get around that by removing
the symlink and readding it as a fake directory.)

> I can see it would be convenient to add special support for a "/" at the
> end of fake files along the lines of your second attempt; however, there
> is no simple, elegant, bug-free way of adding anything to _path_files
> (you're lucky if you get one of the three).  In this case I couldn't see
> anything better than horribly ad-hoc tricks along the lines of "if you
> get a single match at this point in the file and it's got a slash at the
> end then remove the slash and add it again as a removable suffix".
> It's probably doable, but horribly ad-hoc tricks usually don't fit into
> any of the three categories above.
>
> Users are encouraged to look at _path_files for themselves as an
> exercise.

Thanks for the explanation, I gather that I can probably not make it
work easily, so for now I think I'll just put the symlink back :).
Actually, mkdir code does what I want...

Of course, my real question should have been if I can make the
completion listing remove duplicate entries when I have both a real
directotry and an entry in cdpath that matches, but I guess if you
have a real dir foo/bar and a cdpath dir foo/baz you want to be able
to complete to foo/baz too. Maybe it doesn't have to show up as a
cdpath entry at the foo point though, since the cd builtin won't
actually go there anyway?

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 18:19     ` Mikael Magnusson
@ 2009-02-14 19:13       ` Bart Schaefer
  2009-02-14 19:41         ` Mikael Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2009-02-14 19:13 UTC (permalink / raw)
  To: zsh-users

On Feb 14,  7:19pm, Mikael Magnusson wrote:
}
} (No, I've modified the _cd completer a bit to only add $cdpath things
} if the first component is already typed out, because when I'm sitting
} in a dir with only one subdir and type cd <tab> i would like that
} directory completed and not the 50 ones in my cdpath. [...])

Well, that was your first mistake. :-)  You should be able to get the
effect you want using styles.

} Of course, my real question should have been if I can make the
} completion listing remove duplicate entries when I have both a real
} directotry and an entry in cdpath that matches, but I guess if you
} have a real dir foo/bar and a cdpath dir foo/baz you want to be able
} to complete to foo/baz too. Maybe it doesn't have to show up as a
} cdpath entry at the foo point though, since the cd builtin won't
} actually go there anyway?

I'm not sure I'm following the last part of that, but what you need to
look at is the documentation for the tag-order zstyle.  I use this:

    zstyle :completion::complete:cd:: tag-order \
	local-directories path-directories

This says to complete only local directories if there are matches for
those, and if there are no local matches then complete only directories
that are found in the cdpath.  Look at the documentation for "Standard
Tags" to find explanation of local-directories and path-directories.

If you want to complete directories in both places but only show the
local ones in listings, you can use the "hidden" style like so:

    zstyle :completion::complete:cd::path-directories hidden yes

(That's not very clear from the documentation for the "hidden" style.)
You probably don't want to use both tag-order and hidden in this case,
but there might be contexts in which you would.

-- 


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

* Re: Problem with fake-files style and cd
  2009-02-14 19:13       ` Bart Schaefer
@ 2009-02-14 19:41         ` Mikael Magnusson
  2009-02-14 21:39           ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-14 19:41 UTC (permalink / raw)
  To: zsh-users

2009/2/14 Bart Schaefer <schaefer@brasslantern.com>:
> On Feb 14,  7:19pm, Mikael Magnusson wrote:
> }
> } (No, I've modified the _cd completer a bit to only add $cdpath things
> } if the first component is already typed out, because when I'm sitting
> } in a dir with only one subdir and type cd <tab> i would like that
> } directory completed and not the 50 ones in my cdpath. [...])
>
> Well, that was your first mistake. :-)  You should be able to get the
> effect you want using styles.
>
> } Of course, my real question should have been if I can make the
> } completion listing remove duplicate entries when I have both a real
> } directotry and an entry in cdpath that matches, but I guess if you
> } have a real dir foo/bar and a cdpath dir foo/baz you want to be able
> } to complete to foo/baz too. Maybe it doesn't have to show up as a
> } cdpath entry at the foo point though, since the cd builtin won't
> } actually go there anyway?
>
> I'm not sure I'm following the last part of that, but what you need to
> look at is the documentation for the tag-order zstyle.

Even if I had accidentally read that whole section, it would not have
occurred to me it could be used here. After thinking for a few minutes
I realized I can find the strings "local-directories" and
"path-directories" with the _complete_help keybind I have on alt-f9,
or reading through the rest of the documentation in its entirety,
unless I had stumbled across the "Standard Tags" section by chance. In
the context of having read your mail it is very helpful though :). It
is a tiny bit confusing why the name of the "directories" tag is
changed to local-directories only when $cdpath is set, is it for any
other reason than to break all your styles when you set/unset cdpath?

> I use this:
>
>    zstyle :completion::complete:cd:: tag-order \
>        local-directories path-directories
>
> This says to complete only local directories if there are matches for
> those, and if there are no local matches then complete only directories
> that are found in the cdpath.  Look at the documentation for "Standard
> Tags" to find explanation of local-directories and path-directories.

Thanks, with my hack to _cd removed, I think this does more or less
exactly what I want. I wouldn't mind if it was on a per-completion
entry, ie it would be nice if I got this:
% mkdir -p local/code/foo
% mkdir -p path/code/bar
% cdpath=$PWD/path
% cd local
% cd code<tab>
---- local directory
foo/
---- directory in cdpath
bar/

which is what I get without the above style set. However,
% mkdir arg
% cd <tab>
---- local directory
arg/   code/
---- directory in cdpath
code/

I don't want the cdpath to appear in this case, only once I'm actually
completing at a place where they differ. I don't expect anyone to do
anything about this, I'm just saying it would be nice :).

Thanks a lot for your and Peter's help.

> If you want to complete directories in both places but only show the
> local ones in listings, you can use the "hidden" style like so:
>
>    zstyle :completion::complete:cd::path-directories hidden yes
>
> (That's not very clear from the documentation for the "hidden" style.)
> You probably don't want to use both tag-order and hidden in this case,
> but there might be contexts in which you would.

I tried this but it seemed less useful.

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 19:41         ` Mikael Magnusson
@ 2009-02-14 21:39           ` Bart Schaefer
  2009-02-14 22:09             ` Mikael Magnusson
  2009-02-16  9:46             ` Peter Stephenson
  0 siblings, 2 replies; 13+ messages in thread
From: Bart Schaefer @ 2009-02-14 21:39 UTC (permalink / raw)
  To: zsh-users

On Feb 14,  8:41pm, Mikael Magnusson wrote:
}
} 2009/2/14 Bart Schaefer <schaefer@brasslantern.com>:
} > I'm not sure I'm following the last part of that, but what you need to
} > look at is the documentation for the tag-order zstyle.
} 
} Even if I had accidentally read that whole section, it would not have
} occurred to me it could be used here.

Next you need to read chapters 10 and 15 of "From Bash to Z Shell". :-)

(Hey, Peter and Oliver ... any updated revision of the book planned?)

} It is a tiny bit confusing why the name of the "directories" tag is
} changed to local-directories only when $cdpath is set, is it for any
} other reason than to break all your styles when you set/unset cdpath?

It's been like that for years ... in fact originally it appears that
the local-directories style was *always* used, even if cdpath was not
set, so someone (Sven?) probably decided that it didn't make sense to
differentiate "local" if there was no possibility of "non-local".  The
ChangeLog from that time gives no hints.

I'm also sure the expectation was that cdpath is not something that
changes state frequently; it's value might change but not whether it
*has* a value.

} > I use this:
} >
} >    zstyle :completion::complete:cd:: tag-order \
} >        local-directories path-directories

This can easily be modified to deal with a flip-flop of cdpath:

    zstyle :completion::complete:cd:: tag-order \
    	'directories local-directories' path-directories

The local-directories style doc ought to mention this, I guess.

} Thanks, with my hack to _cd removed, I think this does more or less
} exactly what I want. I wouldn't mind if it was on a per-completion
} entry, ie it would be nice if I got this:
} % mkdir -p local/code/foo
} % mkdir -p path/code/bar
} % cdpath=$PWD/path
} % cd local
} % cd code<tab>
} ---- local directory
} foo/
} ---- directory in cdpath
} bar/
} 
} which is what I get without the above style set. However,
} % mkdir arg
} % cd <tab>
} ---- local directory
} arg/   code/
} ---- directory in cdpath
} code/
} 
} I don't want the cdpath to appear in this case, only once I'm actually
} completing at a place where they differ.

I'm not entirely sure, but I think what you're asking for is to have
duplicate completions removed from the listing even when the duplicates
are in different tag groups.  Suppose we add

% mkdir -p path/other/thing

to the above.  Is what you'd like to see:

% cd <tab>
---- local directory
arg/   code/
---- directory in cdpath
other/

??  That isn't something that's supported in the internals, but for a
specific case like this we can the the same effect like so:

zstyle -e :completion::complete:cd::path-directories ignored-patterns \
    	'reply=( *(/) )'

This says that when completing in the cdpath, ignore any name that matches
the name of a directory in the current directory.

In fact I like that so much I might even replace my tag-order with it.


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

* Re: Problem with fake-files style and cd
  2009-02-14 21:39           ` Bart Schaefer
@ 2009-02-14 22:09             ` Mikael Magnusson
  2009-02-14 23:26               ` Bart Schaefer
  2009-02-16  9:46             ` Peter Stephenson
  1 sibling, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-14 22:09 UTC (permalink / raw)
  To: zsh-users

2009/2/14 Bart Schaefer <schaefer@brasslantern.com>:
> On Feb 14,  8:41pm, Mikael Magnusson wrote:
> }
> } 2009/2/14 Bart Schaefer <schaefer@brasslantern.com>:
> } > I'm not sure I'm following the last part of that, but what you need to
> } > look at is the documentation for the tag-order zstyle.
> }
> } Even if I had accidentally read that whole section, it would not have
> } occurred to me it could be used here.
>
> Next you need to read chapters 10 and 15 of "From Bash to Z Shell". :-)
>
> (Hey, Peter and Oliver ... any updated revision of the book planned?)
>
> } Thanks, with my hack to _cd removed, I think this does more or less
> } exactly what I want. I wouldn't mind if it was on a per-completion
> } entry, ie it would be nice if I got this:
> } % mkdir -p local/code/foo
> } % mkdir -p path/code/bar
> } % cdpath=$PWD/path
> } % cd local
> } % cd code<tab>
> } ---- local directory
> } foo/
> } ---- directory in cdpath
> } bar/
> }
> } which is what I get without the above style set. However,
> } % mkdir arg
> } % cd <tab>
> } ---- local directory
> } arg/   code/
> } ---- directory in cdpath
> } code/
> }
> } I don't want the cdpath to appear in this case, only once I'm actually
> } completing at a place where they differ.
>
> I'm not entirely sure, but I think what you're asking for is to have
> duplicate completions removed from the listing even when the duplicates
> are in different tag groups.  Suppose we add
>
> % mkdir -p path/other/thing
>
> to the above.  Is what you'd like to see:
>
> % cd <tab>
> ---- local directory
> arg/   code/
> ---- directory in cdpath
> other/
>
> ??

Yes, but

> That isn't something that's supported in the internals, but for a
> specific case like this we can the the same effect like so:
>
> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>        'reply=( *(/) )'
>
> This says that when completing in the cdpath, ignore any name that matches
> the name of a directory in the current directory.
>
> In fact I like that so much I might even replace my tag-order with it.

while the above appears to work, it really doesn't:
% mkdir path/code/foo
% cd code/<tab>
---- local directory
foo/
---- directory in cdpath
bar/  foo/

Presumably this is because *(/) (which I changed to *(-/) (not in the
above testcase though)) only matches one segment and that *(/) is run
in $PWD, not $PWD/$PREFIX? I have not yet fully understood how this
works, can you access the string being completed in that code snippet,
or can you work around it without doing that? (This time I read both
the ignored-patterns and zstyle -e docs :) ).

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 22:09             ` Mikael Magnusson
@ 2009-02-14 23:26               ` Bart Schaefer
  2009-02-14 23:35                 ` Mikael Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2009-02-14 23:26 UTC (permalink / raw)
  To: zsh-users

On Feb 14, 11:09pm, Mikael Magnusson wrote:
}
} > zstyle -e :completion::complete:cd::path-directories ignored-patterns \
} >        'reply=( *(/) )'
} >
} > This says that when completing in the cdpath, ignore any name that matches
} > the name of a directory in the current directory.
} 
} while the above appears to work, it really doesn't:
} % mkdir path/code/foo
} % cd code/<tab>
} ---- local directory
} foo/
} ---- directory in cdpath
} bar/  foo/
} 
} Presumably this is because *(/) (which I changed to *(-/) (not in the
} above testcase though)) only matches one segment and that *(/) is run
} in $PWD, not $PWD/$PREFIX?

Yep, true.  Try it this way:

zstyle -e :completion::complete:cd::path-directories ignored-patterns \
	'reply=( ${PREFIX}*(-/) )'

You might need to fool around with that a bit; for example, if you don't
use the _expand completer you may want ${~PREFIX}*(-/) instead.  There
may also be tricky bits with IPREFIX, QIPREFIX, and special cases for
completing in the middle of a word instead of at the end.

-- 


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

* Re: Problem with fake-files style and cd
  2009-02-14 23:26               ` Bart Schaefer
@ 2009-02-14 23:35                 ` Mikael Magnusson
  2009-02-15  2:28                   ` Mikael Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-14 23:35 UTC (permalink / raw)
  To: zsh-users

2009/2/15 Bart Schaefer <schaefer@brasslantern.com>:
> On Feb 14, 11:09pm, Mikael Magnusson wrote:
> }
> } > zstyle -e :completion::complete:cd::path-directories ignored-patterns \
> } >        'reply=( *(/) )'
> } >
> } > This says that when completing in the cdpath, ignore any name that matches
> } > the name of a directory in the current directory.
> }
> } while the above appears to work, it really doesn't:
> } % mkdir path/code/foo
> } % cd code/<tab>
> } ---- local directory
> } foo/
> } ---- directory in cdpath
> } bar/  foo/
> }
> } Presumably this is because *(/) (which I changed to *(-/) (not in the
> } above testcase though)) only matches one segment and that *(/) is run
> } in $PWD, not $PWD/$PREFIX?
>
> Yep, true.  Try it this way:
>
> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>        'reply=( ${PREFIX}*(-/) )'
>
> You might need to fool around with that a bit; for example, if you don't
> use the _expand completer you may want ${~PREFIX}*(-/) instead.  There
> may also be tricky bits with IPREFIX, QIPREFIX, and special cases for
> completing in the middle of a word instead of at the end.

Aha, I didn't expect my wild guess to even have the correct variable
name :). If it breaks though, the worst that could happen is that I
get a duplicate entry in the listing though?

Thanks! I'll try this for a while and see what happens.

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 23:35                 ` Mikael Magnusson
@ 2009-02-15  2:28                   ` Mikael Magnusson
  2009-02-15  4:59                     ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-15  2:28 UTC (permalink / raw)
  To: zsh-users

2009/2/15 Mikael Magnusson <mikachu@gmail.com>:
> 2009/2/15 Bart Schaefer <schaefer@brasslantern.com>:
>> On Feb 14, 11:09pm, Mikael Magnusson wrote:
>> }
>> } > zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>> } >        'reply=( *(/) )'
>> } >
>> } > This says that when completing in the cdpath, ignore any name that matches
>> } > the name of a directory in the current directory.
>> }
>> } while the above appears to work, it really doesn't:
>> } % mkdir path/code/foo
>> } % cd code/<tab>
>> } ---- local directory
>> } foo/
>> } ---- directory in cdpath
>> } bar/  foo/
>> }
>> } Presumably this is because *(/) (which I changed to *(-/) (not in the
>> } above testcase though)) only matches one segment and that *(/) is run
>> } in $PWD, not $PWD/$PREFIX?
>>
>> Yep, true.  Try it this way:
>>
>> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>>        'reply=( ${PREFIX}*(-/) )'
>>
>> You might need to fool around with that a bit; for example, if you don't
>> use the _expand completer you may want ${~PREFIX}*(-/) instead.  There
>> may also be tricky bits with IPREFIX, QIPREFIX, and special cases for
>> completing in the middle of a word instead of at the end.
>
> Aha, I didn't expect my wild guess to even have the correct variable
> name :). If it breaks though, the worst that could happen is that I
> get a duplicate entry in the listing though?
>
> Thanks! I'll try this for a while and see what happens.

Okay, it happened now,
% mkdir -p {local,path}/{'path with spaces',pathwithoutspaces}
% cd local
% cd path<tab>
---- local directory
pathwithoutspaces/   path\ with\ spaces/
---- directory in cdpath
path\ with\ spaces/

I tried putting some "" in various constellations in our zstyle to no
avail. Any ideas?

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-15  2:28                   ` Mikael Magnusson
@ 2009-02-15  4:59                     ` Bart Schaefer
  2009-02-15  9:36                       ` Mikael Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2009-02-15  4:59 UTC (permalink / raw)
  To: zsh-users

On Feb 15,  3:28am, Mikael Magnusson wrote:
} Subject: Re: Problem with fake-files style and cd
}
} Okay, it happened now,
} % mkdir -p {local,path}/{'path with spaces',pathwithoutspaces}
} % cd local
} % cd path<tab>
} ---- local directory
} pathwithoutspaces/   path\ with\ spaces/
} ---- directory in cdpath
} path\ with\ spaces/
} 
} I tried putting some "" in various constellations in our zstyle to no
} avail. Any ideas?

That probably should be considered a bug.  The ignored-patterns ought
to be getting compared to the original completions, not to the quoted
form that's going to be inserted onto the command line.

The workaround is this:

zstyle -e :completion::complete:cd::path-directories ignored-patterns \
	'reply=( ${PREFIX}*(-/:q) )'

I don't promise that'll catch all possible cases of odd characters in
file names, but it should get most of the common ones.


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

* Re: Problem with fake-files style and cd
  2009-02-15  4:59                     ` Bart Schaefer
@ 2009-02-15  9:36                       ` Mikael Magnusson
  0 siblings, 0 replies; 13+ messages in thread
From: Mikael Magnusson @ 2009-02-15  9:36 UTC (permalink / raw)
  To: zsh-users

2009/2/15 Bart Schaefer <schaefer@brasslantern.com>:
> On Feb 15,  3:28am, Mikael Magnusson wrote:
> } Subject: Re: Problem with fake-files style and cd
> }
> } Okay, it happened now,
> } % mkdir -p {local,path}/{'path with spaces',pathwithoutspaces}
> } % cd local
> } % cd path<tab>
> } ---- local directory
> } pathwithoutspaces/   path\ with\ spaces/
> } ---- directory in cdpath
> } path\ with\ spaces/
> }
> } I tried putting some "" in various constellations in our zstyle to no
> } avail. Any ideas?
>
> That probably should be considered a bug.  The ignored-patterns ought
> to be getting compared to the original completions, not to the quoted
> form that's going to be inserted onto the command line.
>
> The workaround is this:
>
> zstyle -e :completion::complete:cd::path-directories ignored-patterns \
>        'reply=( ${PREFIX}*(-/:q) )'
>
> I don't promise that'll catch all possible cases of odd characters in
> file names, but it should get most of the common ones.

Aha, thanks again :).

-- 
Mikael Magnusson


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

* Re: Problem with fake-files style and cd
  2009-02-14 21:39           ` Bart Schaefer
  2009-02-14 22:09             ` Mikael Magnusson
@ 2009-02-16  9:46             ` Peter Stephenson
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2009-02-16  9:46 UTC (permalink / raw)
  To: zsh-users

On Sat, 14 Feb 2009 13:39:04 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Next you need to read chapters 10 and 15 of "From Bash to Z Shell". :-)
> 
> (Hey, Peter and Oliver ... any updated revision of the book planned?)

I don't think so, though it's still selling.  However, patches to the shell
documentation are always welcome.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2009-02-16  9:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mikachu@gmail.com>
2009-02-14 14:22 ` Problem with fake-files style and cd Mikael Magnusson
2009-02-14 18:01   ` Peter Stephenson
2009-02-14 18:19     ` Mikael Magnusson
2009-02-14 19:13       ` Bart Schaefer
2009-02-14 19:41         ` Mikael Magnusson
2009-02-14 21:39           ` Bart Schaefer
2009-02-14 22:09             ` Mikael Magnusson
2009-02-14 23:26               ` Bart Schaefer
2009-02-14 23:35                 ` Mikael Magnusson
2009-02-15  2:28                   ` Mikael Magnusson
2009-02-15  4:59                     ` Bart Schaefer
2009-02-15  9:36                       ` Mikael Magnusson
2009-02-16  9:46             ` 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).