1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

zsh-users/10634: try to fix relative paths of completion configuration file

This commit is contained in:
Peter Stephenson 2006-08-21 19:40:34 +00:00
parent 2f0bb9589c
commit f20b66dd24
2 changed files with 25 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2006-08-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* zsh-users/10634: Completion/compinstall: attempt to fix up
relative paths of completion configuration file.
2006-08-21 Clint Adams <clint@zsh.org>
* 22655: Ralph Amissah: Completion/Unix/Command/_sisu:

View file

@ -109,15 +109,23 @@ if [[ -n $basic ]]; then
return
fi
local newifile=$ifile
if [[ $foundold = true ]]; then
print "I have found completion definitions in $ifile.
if [[ $newifile != [~/]* ]]; then
newifile=${ZDOTDIR:-~}/$newifile
print "[Existing completion definition file is not absolute path:
updating to $newifile]"
fi
print "I have found completion definitions in $newifile.
If you want me to read these, just hit return. Otherwise, edit the file
name to look for definitions somewhere else, or delete the whole line
in order not to use existing definitions."
vared -ch -p 'file> ' newifile
[[ -z $newifile ]] && foundold=false
if [[ -n $newifile && $newifile != [/~]* ]]; then
newifile=$PWD/$newifile
print "[Not absolute path: updating to $newifile]"
fi
[[ -z $newifile || ! -f $newfile ]] && foundold=false
else
print "I haven't found any existing completion definitions.
If you have some already defined by compinstall, edit the name of the
@ -126,6 +134,10 @@ are exactly the form in which compinstall inserted them. If you leave
the line as it is, or empty, I won't search."
while true; do
vared -ch -p 'file> ' newifile || break
if [[ -n $newifile && $newifile != [/~]* ]]; then
newifile=$PWD/$newifile
print "[Not absolute path: updating to $newifile]"
fi
if [[ -n $newifile && $ifile != $newifile ]]; then
if __ci_test_ifile $newifile; then
foundold=true
@ -138,7 +150,7 @@ leave the line blank to ignore it."
fi
done
fi
ifile=$newifile
ifile=${~newifile}
if [[ $foundold = true ]]; then
sed -n "/^[ ]*$startline/,/^[ ]*$endline/p" $ifile |
@ -1926,6 +1938,10 @@ if [[ -z $ifile || -d $ifile ]] ||
print "Enter file to save in (~ will be expanded), or return to abort:"
ifile=
vared -ch -p 'file> ' ifile
if [[ $ifile != [/~]* ]]; then
ifile=$PWD/$ifile
print "[Not absolute path; updating to $ifile]"
fi
ifile=${~ifile}
fi