Skip to content

docs(annexes): document @zi-unregister-annex - #913

Merged
ss-o merged 1 commit into
mainfrom
feature-912
Sep 3, 2026
Merged

docs(annexes): document @zi-unregister-annex#913
ss-o merged 1 commit into
mainfrom
feature-912

Conversation

@ss-o

@ss-o ss-o commented Sep 3, 2026

Copy link
Copy Markdown
Member

Documents @zi-unregister-annex, the counterpart to @zi-register-annex added in z-shell/zi#503. One page, English source only.

Why

The overview documented registration with no counterpart, so an annex had no documented way to satisfy the Zsh Plugin Standard unload contract.

Removing a handler while its registration survives leaves Zi dispatching to a function that no longer exists. A missing function returns 127, 127 & 1 is true, so Zi folds the error into its return value and shifts its argument list. Later plug-ins stop loading for the rest of the session, and the first one fails with Error: No plugin or snippet ID given.

That consequence gets a :::warning because the symptom appears a long way from its cause: a plug-in that has nothing to do with the annex simply fails to load.

z-shell/z-a-meta-plugins works around the missing API today by leaving an inert stub in place of its handler, and can stop once this is available.

What is covered

  • the signature, mirroring the registration call's project name and hook type
  • an example placing the call inside the annex's *_plugin_unload function
  • that unregistering something never registered is a no-op, so unload functions need no guard
  • the one limit, in an :::info: ice-modifiers contributed at registration are not withdrawn, because registration does not record which annex contributed which entry, so a leftover ice name stays recognised but dispatches to nothing

Checks

node scripts/validate-code-fences.mjs passes. Both new fences use zi, which the validator's SUPPORTED_LANGUAGES includes and which the surrounding page already uses.

The new [zsh-plugin-standard] link reference resolves to /community/zsh_plugin_standard#unload-function; that anchor exists at community/03_zsh_plugin_standard.mdx:325.

The heading carries an explicit id in the same {/* #... */} form as the rest of the page. Admonitions and code fences balance.

I did not run a full pnpm build: this is a docs-only section addition and the worktree has no node_modules. The fence validator, which is the check that covers what changed, runs standalone and passes.

Closes #912

The overview documented @zi-register-annex with no counterpart, so an annex had
no documented way to satisfy the Plugin Standard unload contract.

Removing a handler while its registration survives leaves Zi dispatching to a
function that no longer exists. The resulting 127 is folded into the return
value and shifts the argument list, so later plug-ins stop loading for the rest
of the session and the first one fails with `Error: No plugin or snippet ID
given.' That consequence is called out in a warning admonition, because the
symptom appears far from its cause.

Covers the signature, that unregistering something never registered is a no-op,
placement inside the annex's unload function, and the one documented limit: the
ice-modifiers contributed at registration are not withdrawn, since registration
does not record which annex contributed which entry.

API added in z-shell/zi#503.

Closes #912
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying zsh with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2094250
Status: ✅  Deploy successful!
Preview URL: https://bccd965f.zsh.pages.dev
Branch Preview URL: https://feature-912.zsh.pages.dev

View logs

@ss-o
ss-o merged commit bfc6d63 into main Sep 3, 2026
7 checks passed
@ss-o
ss-o deleted the feature-912 branch September 3, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document @zi-unregister-annex in the annexes overview

1 participant