fix(help): repair 'help config' wrapper for Fish 4.x embedded help #68

Merged
rootiest merged 1 commits from fix-help-config-fish4-embedded into main 2026-07-04 06:13:25 +00:00
Owner

Summary

Why: On Fish 4.x, the first help config … (e.g. help config --html) prints an error before running:

source: Error encountered while sourcing file '/usr/share/fish/functions/help.fish':
source: No such file or directory
functions: Function 'help' does not exist

Fish 4.x moved the native help function into the binary (embedded:functions/help.fish) — there is no longer an on-disk $__fish_data_dir/functions/help.fish to source. functions/help.fish tried to source that path to back up native help before shadowing it; the source failed, and functions -c help __original_help then ran with no help yet defined. Subsequent calls "worked" only because the file wasn't re-sourced — but __original_help was never captured, silently breaking the native fallback for non-config topics too.

Root cause: the backup can't live in functions/help.fish at all. An autoload shadow of that name makes help resolve to our own wrapper (or nothing, mid-autoload), so functions -c help can never capture the embedded original.

What:

  • Move the wrapper to conf.d/help.fish, sourced at startup before any shadow exists. There functions -c help __original_help copies the embedded native help correctly.
  • Delete the obsolete functions/help.fish.
  • Behavior is otherwise identical: help config …config-help; all other topics → __original_help; the C1 opinionated guard (__fish_config_op_aliases) still applies at runtime.

No dependency on PR #67 — different files, independent root cause.

Manual Verification

  • Open a brand-new shell and run help config --html — it opens the HTML docs with no source:/Function 'help' does not exist error.
  • help config --help prints the config-help usage reference (exit 0).
  • help config keys opens the terminal manual at the Key Bindings section.
  • help string (a non-config topic) still opens fish's native docs for string.
  • functions -q __original_help; and echo backed-up prints backed-up in a fresh shell.
  • With set -g __fish_config_op_aliases 0, help config falls through to native fish help instead of config-help.
## Summary **Why:** On Fish 4.x, the first `help config …` (e.g. `help config --html`) prints an error before running: ``` source: Error encountered while sourcing file '/usr/share/fish/functions/help.fish': source: No such file or directory functions: Function 'help' does not exist ``` Fish 4.x moved the native `help` function into the binary (`embedded:functions/help.fish`) — there is no longer an on-disk `$__fish_data_dir/functions/help.fish` to `source`. `functions/help.fish` tried to source that path to back up native help before shadowing it; the source failed, and `functions -c help __original_help` then ran with no `help` yet defined. Subsequent calls "worked" only because the file wasn't re-sourced — but `__original_help` was never captured, silently breaking the native fallback for non-config topics too. **Root cause:** the backup can't live in `functions/help.fish` at all. An autoload shadow of that name makes `help` resolve to our own wrapper (or nothing, mid-autoload), so `functions -c help` can never capture the embedded original. **What:** - Move the wrapper to **`conf.d/help.fish`**, sourced at startup *before* any shadow exists. There `functions -c help __original_help` copies the embedded native help correctly. - Delete the obsolete **`functions/help.fish`**. - Behavior is otherwise identical: `help config …` → `config-help`; all other topics → `__original_help`; the C1 opinionated guard (`__fish_config_op_aliases`) still applies at runtime. No dependency on PR #67 — different files, independent root cause. ## Manual Verification - [x] Open a **brand-new** shell and run `help config --html` — it opens the HTML docs with **no** `source:`/`Function 'help' does not exist` error. - [x] `help config --help` prints the config-help usage reference (exit 0). - [x] `help config keys` opens the terminal manual at the Key Bindings section. - [x] `help string` (a non-config topic) still opens fish's native docs for `string`. - [x] `functions -q __original_help; and echo backed-up` prints `backed-up` in a fresh shell. - [x] With `set -g __fish_config_op_aliases 0`, `help config` falls through to native fish help instead of `config-help`.
rootiest added 1 commit 2026-07-04 06:11:38 +00:00
Fish 4.x ships the native `help` function embedded in the binary
(embedded:functions/help.fish) with no on-disk file. The old
functions/help.fish tried to `source $__fish_data_dir/functions/help.fish`
to back up the native help before shadowing it — that path no longer exists,
so the first `help config ...` call errored:

    source: No such file or directory
    functions: Function 'help' does not exist

The backup cannot happen from functions/help.fish at all: an autoload shadow
of that name makes `help` resolve to our own wrapper (or nothing, mid-load),
so `functions -c help` can never capture the embedded original.

Move the wrapper to conf.d/help.fish, sourced at startup before any shadow
exists, where `functions -c help __original_help` copies the embedded native
help. Behavior is otherwise unchanged: 'help config' delegates to config-help,
all other topics fall through to __original_help, and the C1 opinionated guard
still applies. Delete the obsolete functions/help.fish.
rootiest merged commit fe3eb818ba into main 2026-07-04 06:13:25 +00:00
rootiest deleted branch fix-help-config-fish4-embedded 2026-07-04 06:13:26 +00:00
Sign in to join this conversation.