From 51f3722e021b1352ed1c239b618408aa7b012b8b Mon Sep 17 00:00:00 2001 From: phisonate <185118920+phisonate@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:13:22 +0200 Subject: [PATCH] Fix `funced` to not expand or execute function name when interactive Due to unnecessary quotes in the prompt command given to `read` by `funced` when editing a function interactively (using `-i`), the name of the function to edit would be evaluated, expanded and even executed (when using command substitution for example), which is at least annoying when using unusual but valid and allowed function names like '*' or 'head (cat)'. This commit delays the function name expansion so that this should no longer happen. --- share/functions/funced.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/funced.fish b/share/functions/funced.fish index 060df7935..bcff40cc2 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -47,7 +47,7 @@ function funced --description 'Edit function definition' functions --no-details -- $funcname | __fish_indent --only-unindent | __fish_indent --no-indent | read -z init end - set -l prompt 'printf "%s%s%s> " (set_color green) '$funcname' (set_color normal)' + set -l prompt 'printf "%s%s%s> " (set_color green) $funcname (set_color normal)' if read -p $prompt -c "$init" --shell cmd echo -n $cmd | __fish_indent --only-unindent | read -lz cmd eval "$cmd"