zsh-users
 help / color / mirror / code / Atom feed
* order of sourcing
@ 2023-01-17 21:07 Ray Andrews
  2023-01-17 21:24 ` Roman Perepelitsa
  0 siblings, 1 reply; 11+ messages in thread
From: Ray Andrews @ 2023-01-17 21:07 UTC (permalink / raw)
  To: Zsh Users

In my .zshrc, to source all my functions I just switch to the directory 
where they're stored and:

     for aa in *(.); do source $aa; done

... seems fine, but sometimes I'm editing one function or another and I 
run into 'not found' issues, like some subsidiary function has been 
'lost'.  Sourcing it's file fixes the 'not found' but I'm wondering if 
there's some standard way of insuring that function files are sourced in 
a preferred order.  For some of them I've renamed the files in an 
alphabetical order since the above code seems to source the files 
alphabetically.  But it's add hoc and messy.  Dunno, I could list them 
all in a file in preferred order and then source that file.  But what's 
the done thing?



^ permalink raw reply	[flat|nested] 11+ messages in thread
* order of sourcing
@ 2023-04-16 16:14 Ray Andrews
  2023-04-16 16:17 ` Roman Perepelitsa
  0 siblings, 1 reply; 11+ messages in thread
From: Ray Andrews @ 2023-04-16 16:14 UTC (permalink / raw)
  To: Zsh Users

I'd like to clear up a little bother:

file aa:

aa ()
{
     bb "howdy!"
}

file bb:

bb ()
{
     echo $1
}

4 /aWorking/Zsh/Source/Wk/Test 0 $ . *    # Just sourcing 'aa' and 'bb'.

4 /aWorking/Zsh/Source/Wk/Test 0 $ aa
aa:2: permission denied: bb

4 /aWorking/Zsh/Source/Wk/Test 0 $ . bb; aa
howdy!

... I think I get it:  'aa' is sourced first and thus 'aa ()' doesn't 
know what 'bb ()' looks like so throws an error until 'bb' is sourced 
again.  But shouldn't 'aa ()' sorta find 'bb ()'  in real time?  It's 
easy enough to deal with but I'm betting there's an easy and better 
solution that doesn't involve ad hoc re-sourcing.




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

end of thread, other threads:[~2023-04-16 20:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 21:07 order of sourcing Ray Andrews
2023-01-17 21:24 ` Roman Perepelitsa
2023-01-17 21:34   ` Bart Schaefer
2023-01-17 21:42     ` Roman Perepelitsa
2023-01-17 21:48     ` Ray Andrews
2023-01-18 21:23       ` Bart Schaefer
2023-01-18 23:44         ` Ray Andrews
2023-04-16 16:14 Ray Andrews
2023-04-16 16:17 ` Roman Perepelitsa
2023-04-16 16:48   ` Ray Andrews
2023-04-16 20:22     ` Ray Andrews

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