extracted via dotfiles commit
fish: wrap/split funced to avoid temp files
By design, funced
uses a temporary file to make changes to functions.
While this is useful so users don't overwrite key functionality in
share/fish/functions
ensuring the edited function can be parsed by
fish
. However, this adds friction (e.g. save, exit, load, run) during
the development of a user-defined function. Improved developmer ergonomics
and fish
's autoloading of functions would be (save and run) with a
separate session.
Additionally, because each "save -> exit -> load -> run" forces the user
to exit the $EDITOR
each time. That also means we also lose the
ability to have consistent undo/session history because each funced
invocation creates a new temporary file.
To enable the editing of a builtin
, there's a helper executable
__funced
that allows for default behavior but also provides a warning.