zsh-users
 help / color / mirror / code / Atom feed
* Re: zsh completion for umount
       [not found] <5815DDAB.8070307__40712.3355348178$1477828401$gmane$org@gmx.ch>
@ 2016-10-30 15:35 ` Daniel Shahaf
  2016-10-30 19:38   ` Fourhundred Thecat
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Shahaf @ 2016-10-30 15:35 UTC (permalink / raw)
  To: Fourhundred Thecat; +Cc: zsh-users

Fourhundred Thecat wrote on Sun, Oct 30, 2016 at 12:46:51 +0100:
> Hello,
> 
> I have /mnt/mmc/ mounted. When I cd to /mnt/ and want to use
> autocompletion to umount mmc:
> 
>  cd /mnt/
>  umount m<tab>
> 
> Nothing happens. Completion does not complete anything.


Try «umount ./m<TAB>».

Making it work for «umount m<TAB>» too shouldn't be too hard.

> Similarly, for mount, the completion does not complete for -o
> 
>   mount -o <tab>
>   mount -o l<tab>
> 
> Nothing.
> 

Are you sure you have completion enabled (run «autoload compinit;
compinit»)?  What's the output of «echo $OSTYPE» on your system?  I get
45 matches when I do «mount -o <TAB>» on linux.

> The completion file Unix/_mount has 1000 lines, yet the very basic
> completion does not work.
> 
> I have switched to zsh from bash recently. While I like the fancy
> features that zsh has, I am increasingly frustrated that basic
> functionality does not work.
> 
> Why does bash get completions right, and zsh doesn't ?
> Don't these problems bother nobody else ?

The problems may well be specific to your setup, especially considering
you've only recently started using zsh.  If some functionality bothers
you, describe the problem and we can see about solving it.

Cheers,

Daniel


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

* Re: zsh completion for umount
  2016-10-30 15:35 ` zsh completion for umount Daniel Shahaf
@ 2016-10-30 19:38   ` Fourhundred Thecat
  2016-10-31  7:47     ` Bart Schaefer
       [not found]     ` <161031004732.ZM18486__31116.0025107258$1477900147$gmane$org@torch.brasslantern.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Fourhundred Thecat @ 2016-10-30 19:38 UTC (permalink / raw)
  To: zsh-users; +Cc: Daniel Shahaf

> On 2016-10-30 16:35, Daniel Shahaf wrote:
> 
> Try «umount ./m<TAB>».

does not work

> Are you sure you have completion enabled (run «autoload compinit;
> compinit»)?  What's the output of «echo $OSTYPE» on your system?  I get
> 45 matches when I do «mount -o <TAB>» on linux.

I have completion enabled in my .zshrc:

  autoload -Uz compinit
  compinit -D

running "autoload compinit" again does not make any difference.

  echo $OSTYPE
  linux-gnu

> The problems may well be specific to your setup, especially considering
> you've only recently started using zsh.  If some functionality bothers
> you, describe the problem and we can see about solving it.

When I remove everything from .zshrc, and only leave following two lines:

  autoload -Uz compinit
  compinit -D

then completion for mount -o <TAB> starts working, same as you describe.
That is great progress. But umount m<TAB> still does not complete, nor
does umount ./m<TAB>

Cheers,



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

* Re: zsh completion for umount
  2016-10-30 19:38   ` Fourhundred Thecat
@ 2016-10-31  7:47     ` Bart Schaefer
       [not found]     ` <161031004732.ZM18486__31116.0025107258$1477900147$gmane$org@torch.brasslantern.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2016-10-31  7:47 UTC (permalink / raw)
  To: zsh-users

On Oct 30,  8:38pm, Fourhundred Thecat wrote:
}
} When I remove everything from .zshrc, and only leave following two lines:
} 
}   autoload -Uz compinit
}   compinit -D
} 
} then completion for mount -o <TAB> starts working, same as you describe.
} That is great progress. But umount m<TAB> still does not complete, nor
} does umount ./m<TAB>

Curious that no one has noticed this before.

Completion for mount / umount works fine as long as you're completing
full paths, either to device files or to mount points.

However, the _canonical_paths function that's used to convert strings
on the command line into the One True Path to either such a device or
mount point, is somewhat deficient when it tries to compare a relative
path to the canonical path, as is necessary to complete the path tail
when the current directory is already part of the canonical path.

I don't have any more time to chase this now, but briefly in case
someone else wants to pick it up:

"_canonical_paths_add_path $PREFIX" is called which, if prefix is not
empty, tries calling zstat to see if it is a real file.  Of course
this fails because it's not a file, it's only a prefix of a filename,
so _canonical_paths_get_canonical_path is NOT called, and the path
from the current directory is not discovered.  The upshot is that
_canonical_paths_add_path only does anything useful if the prefix
on the command line is either already a device or mountpoint, or is
the name of a directory in the partial path to one.

If you try to trick it as Daniel suggested by adding "./", things
are only slightly better in _canonical_paths, but then go sideways
later:  the bug discussed earlier this year, in which the current
prefix is erased but nothing replaces it, affects this completion.


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

* Re: zsh completion for umount
       [not found]     ` <161031004732.ZM18486__31116.0025107258$1477900147$gmane$org@torch.brasslantern.com>
@ 2016-10-31 15:23       ` Daniel Shahaf
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Shahaf @ 2016-10-31 15:23 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer wrote on Mon, Oct 31, 2016 at 00:47:32 -0700:
> If you try to trick it as Daniel suggested by adding "./", things
> are only slightly better in _canonical_paths, but then go sideways
> later:  the bug discussed earlier this year, in which the current
> prefix is erased but nothing replaces it, affects this completion.

For the archives: that bug is workers/39093.


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

* zsh completion for umount
@ 2016-10-30 11:46 Fourhundred Thecat
  0 siblings, 0 replies; 5+ messages in thread
From: Fourhundred Thecat @ 2016-10-30 11:46 UTC (permalink / raw)
  To: zsh-users

Hello,

I have /mnt/mmc/ mounted. When I cd to /mnt/ and want to use
autocompletion to umount mmc:

 cd /mnt/
 umount m<tab>

Nothing happens. Completion does not complete anything.

Similarly, for mount, the completion does not complete for -o

  mount -o <tab>
  mount -o l<tab>

Nothing.

The completion file Unix/_mount has 1000 lines, yet the very basic
completion does not work.

I have switched to zsh from bash recently. While I like the fancy
features that zsh has, I am increasingly frustrated that basic
functionality does not work.

Why does bash get completions right, and zsh doesn't ?
Don't these problems bother nobody else ?

(The above examples were tested on zsh 4.3.17)


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

end of thread, other threads:[~2016-10-31 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5815DDAB.8070307__40712.3355348178$1477828401$gmane$org@gmx.ch>
2016-10-30 15:35 ` zsh completion for umount Daniel Shahaf
2016-10-30 19:38   ` Fourhundred Thecat
2016-10-31  7:47     ` Bart Schaefer
     [not found]     ` <161031004732.ZM18486__31116.0025107258$1477900147$gmane$org@torch.brasslantern.com>
2016-10-31 15:23       ` Daniel Shahaf
2016-10-30 11:46 Fourhundred Thecat

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