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

Re: Automatic hash -d



On Apr 12,  7:08pm, Wayne Davison wrote:
} Subject: Automatic hash -d
}
} In the old completion system, I can complete a path that includes a
} variable prefixed with a ~ without having to first use an explicit
} hash -d.  In the new completion system, this only works if I complete
} just the ~VAR name first.

On Apr 13,  9:50pm, Bart Schaefer wrote:
}
} [Writing about _path-files] ... it expands
} the tilde-expression by checking whether there is already a dirstack
} entry, not by actually evaluating the expression.

This provides the automatic naming of the directory, but I wonder if it
ought to have some kind of style test for performance reasons?

(Line numbers relative to my patch in 13973.)

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.1
diff -u -r1.1 _path_files
--- Completion/Unix/Type/_path_files	2001/04/02 11:36:27	1.1
+++ Completion/Unix/Type/_path_files	2001/04/13 05:00:59
@@ -199,6 +215,7 @@
   # prefix path by setting `prepaths'.
 
   linepath="${pre[2,-1]%%/*}"
+  eval : "~$linepath" 2>/dev/null	# Create nameddir if necessary
   if [[ -z "$linepath" ]]; then
     realpath="${HOME%/}/"
   elif (( $+userdirs[$linepath] )); then

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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