From b7b20e9facbb179a6d43ea2378bd914a08f8a354 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 22 Feb 2024 12:45:20 -0600 Subject: [PATCH] Always `source` file after `funced` (#10318) ... even if the file hasn't changed. This addresses an oddity in the following case: * Shell is started, * function `foo` is sourced from foo.fish * foo.fish is *externally* edited and saved * * `funced foo` loads `type -p foo` showing changed definition, user exits $EDITOR saving no changes (or with $status 0, more generally). * Stale definition of `foo` remains (cherry picked from commit 2c2ab0c1fac1c982a682594d920e8fef735106fd) --- share/functions/funced.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/functions/funced.fish b/share/functions/funced.fish index 1cba34efa..3724b4eb5 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -114,7 +114,9 @@ function funced --description 'Edit function definition' set -l new_checksum (__funced_md5 "$tmpname") if test "$new_checksum" = "$checksum" echo (_ "Editor exited but the function was not modified") - # Don't source or save an unmodified file. + # Source but don't save an unmodified file. + # (Source in case the file changed externally since we first loaded it.) + source "$writepath" break end end