zsh-users
 help / color / mirror / code / Atom feed
* FPATH being reset after .zshenv
@ 2001-08-01  9:25 martin.ebourne
  2001-08-01  9:52 ` Borsenkow Andrej
  0 siblings, 1 reply; 6+ messages in thread
From: martin.ebourne @ 2001-08-01  9:25 UTC (permalink / raw)
  To: zsh-users


Hi,

I would like to enable a number of my local functions for autoloading in
all instances of zsh - interactive or otherwise.

To do this I have modified fpath and registered functions for autoloading
in the .zshenv file, which as I understand it is the only one it will
always execute.

Unfortunately it seems that zsh resets the fpath after executing this file
(it is empty while running the file). It does however, remember the
autoload commands, which obviously then become useless.

Why does it behave this way round? Is there anything I can do to get the
effect I want?

Cheers,

Martin.




This e-mail message is CONFIDENTIAL and may contain legally privileged
information.  If you are not the intended recipient you should not  read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system.  E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.


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

* RE: FPATH being reset after .zshenv
  2001-08-01  9:25 FPATH being reset after .zshenv martin.ebourne
@ 2001-08-01  9:52 ` Borsenkow Andrej
  0 siblings, 0 replies; 6+ messages in thread
From: Borsenkow Andrej @ 2001-08-01  9:52 UTC (permalink / raw)
  To: martin.ebourne, zsh-users

>
> I would like to enable a number of my local functions for autoloading in
> all instances of zsh - interactive or otherwise.
>
> To do this I have modified fpath and registered functions for autoloading
> in the .zshenv file, which as I understand it is the only one it will
> always execute.
>

Even this one is skipped if zsh is started with -f or NO_RCS option is set
in /etc/zshenv. It is the only file that is garanteed to be executed.

> Unfortunately it seems that zsh resets the fpath after executing this file
> (it is empty while running the file). It does however, remember the
> autoload commands, which obviously then become useless.
>

I cannot reproduce it. Are you sure it is not reset in any other startup
file?

-andrej


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

* RE: FPATH being reset after .zshenv
  2001-08-01 11:05 martin.ebourne
@ 2001-08-01 11:30 ` Borsenkow Andrej
  0 siblings, 0 replies; 6+ messages in thread
From: Borsenkow Andrej @ 2001-08-01 11:30 UTC (permalink / raw)
  To: martin.ebourne; +Cc: zsh-users


> Well I could but there's rather a lot. (1720 lines/29 files of normal
> config, and 4210 lines/105 files of autoloaded functions which it
> makes use
> of.)

Ick. You want to say that every zsh script you (ever) write needs this
stuff? You must have very fast computer :-)


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

* RE: FPATH being reset after .zshenv
@ 2001-08-01 11:05 martin.ebourne
  2001-08-01 11:30 ` Borsenkow Andrej
  0 siblings, 1 reply; 6+ messages in thread
From: martin.ebourne @ 2001-08-01 11:05 UTC (permalink / raw)
  To: Borsenkow Andrej; +Cc: zsh-users





   What do you mean exactly? If you used it in a *function* inside a
   .zshenv
   and then changed FPATH inside the same function, then it should have
   described effect.


Right again. All my config is in a hierarchy of directories in multiple
files. All the config ends up in a function for two reasons:
(i) I use a function to check the file's location and execute the file, and
(ii) the zsh profiler works on functions and it allows me to usefully
profile the startup config.


   I just tried with ~/.zshenv looking like

   FPATH=foo:$FPATH
   typeset -U FPATH

   and fpath is not cleared (and never was).


Okay, I'm sure that's what it'll do.


   Could you show your .zshrc?


Well I could but there's rather a lot. (1720 lines/29 files of normal
config, and 4210 lines/105 files of autoloaded functions which it makes use
of.) The problem's solved now though, so perhaps I'll leave that for
another time when I can't figure out what's wrong. ;)

Thanks for your rapid reply,

Martin.




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

* RE: FPATH being reset after .zshenv
  2001-08-01 10:19 martin.ebourne
@ 2001-08-01 10:37 ` Borsenkow Andrej
  0 siblings, 0 replies; 6+ messages in thread
From: Borsenkow Andrej @ 2001-08-01 10:37 UTC (permalink / raw)
  To: martin.ebourne; +Cc: zsh-users

>
> I've looked into it some more, and found the culprit. I had the following
> line earlier on:
>
> typeset -U FPATH
>
> which obviously makes the parameter local as a side effect. I've
> changed it
> to -Ug now which is working fine.
>

What do you mean exactly? If you used it in a *function* inside a .zshenv
and then changed FPATH inside the same function, then it should have
described effect.

I just tried with ~/.zshenv looking like

FPATH=foo:$FPATH
typeset -U FPATH

and fpath is not cleared (and never was).

Could you show your .zshrc?

-andrej


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

* RE: FPATH being reset after .zshenv
@ 2001-08-01 10:19 martin.ebourne
  2001-08-01 10:37 ` Borsenkow Andrej
  0 siblings, 1 reply; 6+ messages in thread
From: martin.ebourne @ 2001-08-01 10:19 UTC (permalink / raw)
  To: Borsenkow Andrej; +Cc: zsh-users






   > Unfortunately it seems that zsh resets the fpath after executing this
   file
   > (it is empty while running the file). It does however, remember the
   > autoload commands, which obviously then become useless.
   >

   I cannot reproduce it. Are you sure it is not reset in any other startup
   file?

I've looked into it some more, and found the culprit. I had the following
line earlier on:

typeset -U FPATH

which obviously makes the parameter local as a side effect. I've changed it
to -Ug now which is working fine.

Having looked back at the info documentation, I suspect what confused me
into leaving the -g out is the bit that says 'This flag does not affect the
parameter after creation':

     The -g (global) flag is treated specially: it means that any
     resulting parameter will not be restricted to local scope.  Note
     that this does not necessarily mean that the parameter will be
     global, as the flag will apply to any existing parameter (even if
     unset) from an enclosing function.  This flag does not affect the
     parameter after creation, hence it has no effect when listing
     existing parameters, nor does the flag +g have any effect except
     in combination with -m (see below).
Anyhow, thanks for the help.

Martin.



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

end of thread, other threads:[~2001-08-01 11:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-01  9:25 FPATH being reset after .zshenv martin.ebourne
2001-08-01  9:52 ` Borsenkow Andrej
2001-08-01 10:19 martin.ebourne
2001-08-01 10:37 ` Borsenkow Andrej
2001-08-01 11:05 martin.ebourne
2001-08-01 11:30 ` Borsenkow Andrej

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