diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-02-20 10:26:57 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-02-20 10:26:57 -0800 |
commit | 3ab954644fb8c0997a4eeb6830e8e342de5aff8a (patch) | |
tree | 652063f3586cfe712c43cb90597dfa7c16e38335 /share/functions/__fish_config_interactive.fish | |
parent | 64953e26fc5e2de8afdcecdca3162c95d6416d30 (diff) |
Make fish install a command_not_found handler in non-interactive uses.
Previously, fish's command_not_found handler would be installed in
__fish_config_interactive. Errors that occured early in startup (e.g. in
config.fish) or in non-interactive mode would therefore not be reported.
With this change, fish now exposes its default cnf handler as
__fish_default_command_not_found_handler . config.fish then installs a
cnfh that invokes the default. When fish goes interactive, the initial
cnfh is overwritten with a fancier one, that may in turn fall back to
invoking the default.
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r-- | share/functions/__fish_config_interactive.fish | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 3d7b0d37..f350644d 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -233,6 +233,11 @@ function __fish_config_interactive -d "Initializations that should be performed # The first time a command is not found, look for command-not-found # This is not cheap so we try to avoid doing it during startup + # config.fish already installed a handler for noninteractive command-not-found, + # so delete it here since we are now interactive + functions -e __fish_command_not_found_handler + + # Now install our fancy variant function __fish_command_not_found_setup --on-event fish_command_not_found # Remove fish_command_not_found_setup so we only execute this once functions --erase __fish_command_not_found_setup @@ -262,7 +267,7 @@ function __fish_config_interactive -d "Initializations that should be performed # Use standard fish command not found handler otherwise else function __fish_command_not_found_handler --on-event fish_command_not_found - echo fish: Unknown command "'$argv'" >&2 + __fish_default_command_not_found_handler $argv end end __fish_command_not_found_handler $argv |