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

PATCH: quiet _path_files



Until now, _path_files printed ugly error messages when completing
after ~foo/<TAB> where ~foo was neither a known user nor a named
directory. This makes it display a message, just like _tilde_files.

Or should we make them completely quiet?

Bye
 Sven

diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files
--- ../z.old/Completion/Core/_path_files	Fri Feb 25 14:17:21 2000
+++ Completion/Core/_path_files	Fri Feb 25 16:47:29 2000
@@ -172,9 +172,19 @@
   # prefix from the string to complete, set `donepath' to build the correct
   # paths and make sure that the loop below is run only once with an empty
   # prefix path by setting `prepaths'.
-  
-  linepath="${pre%%/*}/"
-  realpath=$~linepath
+
+  linepath="${pre[2,-1]%%/*}"
+  if [[ -z "$linepath" ]]; then
+    realpath="${HOME%/}/"
+  elif (( $+userdirs[$linepath] )); then
+    realpath="${userdirs[$linepath]%/}/"
+  elif (( $+nameddirs[$linepath] )); then
+    realpath="${nameddirs[$linepath]%/}/"
+  else
+    _message "unknown user \`$linepath'"
+    return 1
+  fi
+  linepath="~${linepath}/"
   [[ "$realpath" = "$linepath" ]] && return 1
   pre="${pre#*/}"
   orig="${orig#*/}"

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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