fix(help): repair 'help config' wrapper for Fish 4.x embedded help #68
Reference in New Issue
Block a user
Delete Branch "fix-help-config-fish4-embedded"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Why: On Fish 4.x, the first
help config …(e.g.help config --html) prints an error before running:Fish 4.x moved the native
helpfunction into the binary (embedded:functions/help.fish) — there is no longer an on-disk$__fish_data_dir/functions/help.fishtosource.functions/help.fishtried to source that path to back up native help before shadowing it; the source failed, andfunctions -c help __original_helpthen ran with nohelpyet defined. Subsequent calls "worked" only because the file wasn't re-sourced — but__original_helpwas never captured, silently breaking the native fallback for non-config topics too.Root cause: the backup can't live in
functions/help.fishat all. An autoload shadow of that name makeshelpresolve to our own wrapper (or nothing, mid-autoload), sofunctions -c helpcan never capture the embedded original.What:
conf.d/help.fish, sourced at startup before any shadow exists. Therefunctions -c help __original_helpcopies the embedded native help correctly.functions/help.fish.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
help config --html— it opens the HTML docs with nosource:/Function 'help' does not existerror.help config --helpprints the config-help usage reference (exit 0).help config keysopens the terminal manual at the Key Bindings section.help string(a non-config topic) still opens fish's native docs forstring.functions -q __original_help; and echo backed-upprintsbacked-upin a fresh shell.set -g __fish_config_op_aliases 0,help configfalls through to native fish help instead ofconfig-help.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.