From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: order of sourcing
Date: Tue, 17 Jan 2023 22:24:10 +0100 [thread overview]
Message-ID: <CAN=4vMqV+uxJXBLoOYGicAXjB07yv7mwrUS26hG34J0PnUNK_w@mail.gmail.com> (raw)
In-Reply-To: <bb9bb69a-8608-ec18-d340-740fc813eec3@eastlink.ca>
On Tue, Jan 17, 2023 at 10:10 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> 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?
The standard solution is to autoload functions. It solves a bunch of
other problems that you get when sourcing files with function
definitions:
- You no longer pay the startup time penalty.
- You can rely on the standard options being in effect when the
function is parsed.
- You can rely on there being no aliases when the function is parsed.
Roman.
next prev parent reply other threads:[~2023-01-17 21:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 21:07 Ray Andrews
2023-01-17 21:24 ` Roman Perepelitsa [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN=4vMqV+uxJXBLoOYGicAXjB07yv7mwrUS26hG34J0PnUNK_w@mail.gmail.com' \
--to=roman.perepelitsa@gmail.com \
--cc=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).