Let funced handle empty $EDITOR

For some weird reason we only used $editor if it wasn't empty, but
then failed to fail if it was.

This will now print an error and use fish, just like if the $EDITOR
value is invalid in any other way.

Fixes #5257.
This commit is contained in:
Fabian Homborg 2018-10-15 10:13:19 +02:00
parent c140b3c724
commit d22446f651

View File

@ -46,13 +46,11 @@ function funced --description 'Edit function definition'
end
# Break editor up to get its first command (i.e. discard flags)
if test -n "$editor"
set -l editor_cmd
eval set editor_cmd $editor
if not type -q -f "$editor_cmd[1]"
echo (_ "funced: The value for \$EDITOR '$editor' could not be used because the command '$editor_cmd[1]' could not be found")
set editor fish
end
set -l editor_cmd
eval set editor_cmd $editor
if not type -q -f "$editor_cmd[1]"
echo (_ "funced: The value for \$EDITOR '$editor' could not be used because the command '$editor_cmd[1]' could not be found")
set editor fish
end
if test "$editor" = fish