zsh-workers
 help / color / mirror / code / Atom feed
* Cygwin path completion
@ 2000-06-16 13:27 Andrej Borsenkow
  2000-06-16 13:47 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Andrej Borsenkow @ 2000-06-16 13:27 UTC (permalink / raw)
  To: ZSH workers mailing list

Cygwin has magic prefix ``/cygdrive'' that can be used to access any
drive under NT (obviating need to explicitly mount them).
``/cygdrive/d/foo'' is the same as ``D:\foo''. Currently Zsh cannot
complete path beginning with /cygdrive because it tries globbing and
this does not work (hmm ... may be, it may be considered a bug in
Cygwin):

mw1g017@MW1G17C:/cygdrive/h/src% ls /cygdrive
ls: /cygdrive: No such file or directory
mw1g017@MW1G17C:/cygdrive/h/src% ls /cygdrive/c
AUTOEXEC.BAT                SYSBUILD
Aladdin                     System Volume Information
......
mw1g017@MW1G17C:/cygdrive/h/src% ls /
PalmDev                 lib                     uninst.bat
bin                     login.README            usr
etc                     prc-tools               var
inetutils-1.3.2.README  tmp

(note current dir as /cygdrive/h/... - this is $HOME on server). Even if
we cannot find out all drives (is it possible?) _path_files still has to
treat /cygdrive/?/ specially, and not try to glob it. It can also always
offer ``cygdrive'' for the first component (of course, if it matches
current prefix/suffix).

-andrej

Have a nice DOS!
B >>


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Cygwin path completion
@ 2000-06-16 14:54 Sven Wischnowsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sven Wischnowsky @ 2000-06-16 14:54 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> Andrej wrote:
> > Even if
> > we cannot find out all drives (is it possible?) _path_files still has to
> > treat /cygdrive/?/ specially, and not try to glob it. It can also always
> > offer ``cygdrive'' for the first component (of course, if it matches
> > current prefix/suffix).
> 
> Sven will have to answer for the feasibility of all of this, but...
> 
> One thing that might fit our needs here and elsewhere (e.g. speedups of
> path completion when you know you don't want initial path components
> re-jigged) is a style along the lines of fix-path-prefix, only maybe with a
> better name.  A number would fix that many components (`2', here), while
> something else e.g. `all' would turn off completion of earlier bits of the
> path altogether.  A more generic `fix-prefix' might possibly be useful in
> certain other completions.

[Btw. I forgot to remove the optimation in the C-code again that makes 
initial existing directories be accepted immediately. We can't do
that, because, if you have `foo/x' and `foobar/y' and try `./foo/y<TAB>'
it won't complete to `foobar/y'. (It will work with `foo/y' for
another reason...) ]

Is the number really enough? But only if statting the thing shows that 
there is such a file, right? I think I'd still prefer patterns -- they 
are more flexible and can still made to match a certain number of
components.

Maybe we'll just have to try.


Andrej Borsenkow answered:

> While this may be useful, I meant something different. I'd prefer if
> /c/d/t would still complete to /cygdrive/d/temp. I meant, that
> _path_files (BTW I agree that it already deserves to be converted to
> shell code. It may even give old compctl the ability to complete paths)

I guess you mean C. And we started already. And _path_files (with some 
more optimisations I sent this morning) isn't really that slow anymore.

I, at least, will *not* do anything to help compctl. Never again.

> should simply stuff cygdrive as first component. In the above case the
> possible completions would consist of
> 
> /c*/d*/t* AND
> /cygdrive/d/t*

That's of course a completely different thing from the accept-thingy.

I know nothing about cygwin, but maybe a style for _path_files that
gives pairs of patterns and (sets of) strings. If the word on the line 
matches a pattern, the strings will be taken to be possible
completions. So you could do:

  zstyle '...:paths' fake-paths '/[^/]#:cygdrive' '/cygdrive/:a b c d'

Maybe even with ways to say `only that' and `this plus whatever you
find yourself'.

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Cygwin path completion
@ 2000-06-16 15:01 Sven Wischnowsky
  2000-06-16 15:49 ` Andrej Borsenkow
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2000-06-16 15:01 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> > I meant something different. I'd prefer if
> > /c/d/t would still complete to /cygdrive/d/temp. I meant, that
> > _path_files (BTW I agree that it already deserves to be converted to
> > shell code. It may even give old compctl the ability to complete paths)
> > should simply stuff cygdrive as first component. In the above case the
> > possible completions would consist of
> 
> This is far too specific to be hard-wired into _path_files, but maybe
> there's some way of specifying transformations.  I still don't understand
> how that helps you since I don't see when you want cygdrive to be the first
> component.  It seems to me you should be using a named directory or
> something, e.g.
> 
> c=/cygdrive
> : ~c
> echo ~c/d/...
> 
> You can hardly get fewer characters than that.

Right.


I forgot to say... the fake-path thing I just suggested could also
help us to do something I've been missing some time ago (and then
forgot again, of course, sigh): completion of auto-mounted directories.

Bye
 Sven


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


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

end of thread, other threads:[~2000-06-16 15:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-16 13:27 Cygwin path completion Andrej Borsenkow
2000-06-16 13:47 ` Peter Stephenson
2000-06-16 14:24   ` Andrej Borsenkow
2000-06-16 14:57     ` Peter Stephenson
2000-06-16 14:54 Sven Wischnowsky
2000-06-16 15:01 Sven Wischnowsky
2000-06-16 15:49 ` Andrej Borsenkow

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