zsh-users
 help / color / mirror / code / Atom feed
* compinstall and command to add to the .zshrc
@ 2006-05-03 15:25 Vincent Lefevre
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Lefevre @ 2006-05-03 15:25 UTC (permalink / raw)
  To: zsh-users

After running compinstall, I get:

Enter file to save in (~ will be expanded), or return to abort:
file> .zcomp
If you want this file to be run automatically, you should add
  . .zcomp
to your .zshrc.  compinstall will remember the name of this file for
future use.

But the zshbuiltins(1) man page says that the shell looks in the
components of $path to find the directory containing the file.
So, I don't see how this can work, unless ~ is in $path, and it
usually isn't. Shouldn't compinstall have said ". ~/.zcomp"?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


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

* Re: compinstall and command to add to the .zshrc
  2006-08-20 22:19 ` Vincent Lefevre
@ 2006-08-20 22:50   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2006-08-20 22:50 UTC (permalink / raw)
  To: zsh-users

Vincent Lefevre wrote:
> After running compinstall, I get:
> 
> Enter file to save in (~ will be expanded), or return to abort:
> file> .zcomp
> If you want this file to be run automatically, you should add
>   . .zcomp
> to your .zshrc.  compinstall will remember the name of this file for
> future use.
> 
> But the zshbuiltins(1) man page says that the shell looks in the
> components of $path to find the directory containing the file.
> So, I don't see how this can work, unless ~ is in $path, and it
> usually isn't. Shouldn't compinstall have said ". ~/.zcomp"?

We discussed this and it's because the user entered a relative path.
The following is supposed to intercept that.  I haven't tried every
combination.

Index: Completion/compinstall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/compinstall,v
retrieving revision 1.9
diff -u -r1.9 compinstall
--- Completion/compinstall	23 Nov 2005 11:29:21 -0000	1.9
+++ Completion/compinstall	20 Aug 2006 22:47:57 -0000
@@ -109,15 +109,23 @@
   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 @@
 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 @@
     fi
   done
 fi
-ifile=$newifile
+ifile=${~newifile}
 
 if [[ $foundold = true ]]; then
   sed -n "/^[ 	]*$startline/,/^[ 	]*$endline/p" $ifile |
@@ -1926,6 +1938,10 @@
    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
 
-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* compinstall and command to add to the .zshrc
@ 2006-08-20 22:19 ` Vincent Lefevre
  2006-08-20 22:50   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Lefevre @ 2006-08-20 22:19 UTC (permalink / raw)
  To: zsh-users

This is old, but it seems that no-one replied...
I get this with zsh 4.3.2.

----- Forwarded message from Vincent Lefevre <vincent@vinc17.org> -----

Date: Wed, 3 May 2006 17:25:14 +0200
From: Vincent Lefevre <vincent@vinc17.org>
To: zsh-users@sunsite.dk
Subject: compinstall and command to add to the .zshrc
X-seq: zsh-users 10209

After running compinstall, I get:

Enter file to save in (~ will be expanded), or return to abort:
file> .zcomp
If you want this file to be run automatically, you should add
  . .zcomp
to your .zshrc.  compinstall will remember the name of this file for
future use.

But the zshbuiltins(1) man page says that the shell looks in the
components of $path to find the directory containing the file.
So, I don't see how this can work, unless ~ is in $path, and it
usually isn't. Shouldn't compinstall have said ". ~/.zcomp"?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

----- End forwarded message -----


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

end of thread, other threads:[~2006-08-20 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-03 15:25 compinstall and command to add to the .zshrc Vincent Lefevre
     [not found] <vincent@vinc17.org>
2006-08-20 22:19 ` Vincent Lefevre
2006-08-20 22:50   ` Peter Stephenson

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