zsh-workers
 help / color / mirror / code / Atom feed
* pws-19: compinstall should build absolute paths
@ 1999-05-27 15:05 Andrej Borsenkow
  1999-05-29 10:30 ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-05-27 15:05 UTC (permalink / raw)
  To: ZSH workers mailing list

Reinstalling one of my machines I took the chance to try compinstall. I
noted, that it takes given paths literally: I was in home and used

source .zsh.d/compinstall

that resulted in relative paths placed in .zshrc:

. .zsh.d/compinit -f .zsh.d -d

this 'course fails, if you start zsh from any other dir :-(

/andrej


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

* PATCH: Re: pws-19: compinstall should build absolute paths
  1999-05-27 15:05 pws-19: compinstall should build absolute paths Andrej Borsenkow
@ 1999-05-29 10:30 ` Bart Schaefer
  1999-05-31  6:41   ` Andrej Borsenkow
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1999-05-29 10:30 UTC (permalink / raw)
  To: ZSH workers mailing list

On May 27,  7:05pm, Andrej Borsenkow wrote:
} Subject: pws-19: compinstall should build absolute paths
}
} source .zsh.d/compinstall
} 
} that resulted in relative paths placed in .zshrc:
} 
} . .zsh.d/compinit -f .zsh.d -d

I'm not entirely certain that using absolute paths is the best thing here;
I worry about things like NFS filesystems that don't have the same mount
points everywhere.  But I can't think of anything better.

Index: Completion/Core/compinstall
===================================================================
@@ -141,6 +141,9 @@
 else
   print "Keeping existing completion directiory $_ci_fdir"
 fi
+if [[ ${~_ci_fdir} != /* ]]; then
+  _ci_fdir=$(cd $_ci_fdir;builtin pwd)
+fi
 
 # Check if this is in fpath already, else put it there (with ~'s expanded).
 _ci_f=${~_ci_fdir}

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


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

* RE: PATCH: Re: pws-19: compinstall should build absolute paths
  1999-05-29 10:30 ` PATCH: " Bart Schaefer
@ 1999-05-31  6:41   ` Andrej Borsenkow
  1999-05-31  7:08     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-05-31  6:41 UTC (permalink / raw)
  To: Bart Schaefer, ZSH workers mailing list


> I'm not entirely certain that using absolute paths is the best thing here;
> I worry about things like NFS filesystems that don't have the same mount
> points everywhere.  But I can't think of anything better.
>

I am not sure, that compinstall can take in account all possible
configurations. In case of NFS mounted HOME (probably, the most common
case) - I always used ``~/...'' - that should be portable even if HOME
changes.

> +if [[ ${~_ci_fdir} != /* ]]; then
> +  _ci_fdir=$(cd $_ci_fdir;builtin pwd)
> +fi
>
>  # Check if this is in fpath already, else put it there (with ~'s
> expanded).
>  _ci_f=${~_ci_fdir}
>

Ehh ... but at this point _ci_fdir is an absolute path ... and starts with
``/'' ... so _ci_f is set to some directory in HOME instead to _ci_fdir, is
not it?

/andrej


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

* Re: PATCH: Re: pws-19: compinstall should build absolute paths
  1999-05-31  6:41   ` Andrej Borsenkow
@ 1999-05-31  7:08     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1999-05-31  7:08 UTC (permalink / raw)
  To: Andrej Borsenkow, ZSH workers mailing list

On May 31, 10:41am, Andrej Borsenkow wrote:
} Subject: RE: PATCH: Re: pws-19: compinstall should build absolute paths
}
} > +if [[ ${~_ci_fdir} != /* ]]; then
} > +  _ci_fdir=$(cd $_ci_fdir;builtin pwd)
} > +fi
} >
} >  # Check if this is in fpath already, else put it there (with ~'s
} > expanded).
} >  _ci_f=${~_ci_fdir}
} >
} 
} Ehh ... but at this point _ci_fdir is an absolute path ... and starts with
} ``/'' ... so _ci_f is set to some directory in HOME instead to _ci_fdir, is
} not it?

Is not it.  Note the ${ } there; the ~ in the assignment just causes any
glob patterns or tildes in the value of $_ci_fdir to be expanded.  What
the lines I added do is, if attempting to expand the value of $_ci_fdir
does not produce a full path, then force it to be a full path.  If there
is already a home-directory reference (that is, a tilde) in $_ci_fdir
then [[ ${~_ci_fdir} != /* ]] will be false and the full path is not
recomputed.

Then the pre-existing bit of code following "# Check if ..." expands the
full path again and stuffs that in $_ci_f.  The end result, I believe, is
that the unexpanded home-directory reference goes into .zshrc, but the
expanded full path is used in $fpath.  If you don't find that's what is
happening, let me know.

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


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

end of thread, other threads:[~1999-05-31  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-27 15:05 pws-19: compinstall should build absolute paths Andrej Borsenkow
1999-05-29 10:30 ` PATCH: " Bart Schaefer
1999-05-31  6:41   ` Andrej Borsenkow
1999-05-31  7:08     ` Bart Schaefer

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