Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autoload +X xxx zero reference count
- X-seq: zsh-workers 54360
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: autoload +X xxx zero reference count
- Date: Wed, 15 Apr 2026 12:57:18 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0CQ46mtCIfpeVhGEwzRsoars55noL2NnICVrg90rrrE=; fh=DSq7imBqIFzdbbKtbVCpdy8HVz0gMsj8pDLr9jpnRMA=; b=h784N+PMT0C7OXeTV2gVm+weU1I2jEkqly5CENWTfNwtJ5Fastds4Z4Co8/ajHdZmw LoQKV0yDefjh74fAbrt/37a7Xd/rsmKm4PSxSiZ+AEVfDu/h/xi5yMN7kEpsPH3T0w9D kOeqis50Ap85j3HaB6hmPUDPta5SZ6oRVnslgEDPZ5ZMxoKjoZLyK2xI+e1Z2quZUt2x QDN2W6y6ijzpuAUwWo9Hj+1nlOYCp4I2gkwl0rg9OfmR3ek98k6T7mrhfJ/bPUhC5Ptp fAEiFvQzAdnkvGqHA12EpUaMwRWLtOK3aiSQTw2eAGuGOjoB+LFJzUdWI3j5JJSs4e8R OT9w==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1776283050; cv=none; d=google.com; s=arc-20240605; b=hOthywDH6RovrJyf5d/Pn2cTEaGB6y8KLs+dDcmXkG9c5K12RDyyGTkZYmzfo8CZG1 JxyyavAbnGIoDDMCCwsCqa3OYexXdbVbhnOLZjWQqyMcGiMnacjfWpBcl48FPv6r3TFO n2hmFrgCZqRLGdNbomg8T9Jyt/cnq3Ca9CwPIqk2q8j9F7uhGT0XU3HxBxs79t22B509 hRJ3XuWWdZjYFjmc0i/FdojRssrRiTo13megcZV6O8pPJBX5NsoXs6QgZlbM+jMoKDhr bsbbJL7rsfMqJQjZIGBT0puV9Io5q9NtuKNezC5LziPAyZ0iRgXwH5NfRmpVDlc68UXG CuCw==
- Archived-at: <https://zsh.org/workers/54360>
- In-reply-to: <CAHYJk3T-dvxQ7JPfq7GRyQf_YWhbpuH7vw52kZ33C0Ltb5X4LA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHYJk3T-dvxQ7JPfq7GRyQf_YWhbpuH7vw52kZ33C0Ltb5X4LA@mail.gmail.com>
On Wed, Apr 15, 2026 at 8:27 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> autoreload () {
> unfunction - $@
> autoload -Uz +X - $@
> }
>
> and as it turns out this doesn't work on functions that were
> autoloaded with an absolute path outside of fpath.
I know you said "beside the point" but:
autoreload () {
[[ -n "$1" ]] || {
return 1
eval "echo Not running zsh. ; exit 1"
}
local fn w IFS
unset IFS # Paranoia
for fn in "$@"
do
w=($(whence -v "$fn"))
if [[ $w = *function* ]]
then
unfunction - "$fn"
case $w in
($fn is a* shell function from *) autoload -Uz +X - ${w[-1]} ;;
(*) autoload -Uz +X - "$fn" ;;
esac
else
print -u2 -r -- $w
fi
done
}
Needs massaging if your autoload path has spaces in it.
> I bisected the error to 8f5fe841a63fecdab4416578653549689f2c592f but
> that's simply the commit that adds the error message.
Hm, that's supposed to be detecting a special case of a function being
removed during its own execution, but maybe it's firing for
not-yet-loaded autoloads?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author