Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Re: zsh completion for umount



On Oct 31, 12:47am, Bart Schaefer wrote:
}
} "_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

OK, this is a lot better:

diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths
index 9bccc7f..dde41f3 100644
--- a/Completion/Unix/Type/_canonical_paths
+++ b/Completion/Unix/Type/_canonical_paths
@@ -69,7 +69,10 @@ _canonical_paths_add_paths () {
   expref=${~origpref} 2>/dev/null
   [[ $origpref == (|*/). ]] && rltrim=.
   curpref=${${expref%$rltrim}:-./}
-  if zstat $curpref >&/dev/null; then
+  if [[ $expref:h == (.|..) ]]; then
+    _canonical_paths_pwd $expref:h
+    canpref=$REPLY/$expref:t
+  elif zstat $curpref >&/dev/null; then
     _canonical_paths_get_canonical_path $curpref
     canpref=$REPLY
   else


The remaining problem is that _canonical_paths_pwd screws up "cd -" and
friends by frobbing the directory stack with pushd/popd.  I may go back
to that in another thread.



Messages sorted by: Reverse Date, Date, Thread, Author