aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_config_interactive.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-08-31 18:39:15 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-08-31 18:39:15 +0200
commit2f3123e1757f495afc799f0c734283d4513db0f8 (patch)
tree69b645e55b40de1b215e44cdce9b07700d3e073c /share/functions/__fish_config_interactive.fish
parent17c756971a1e6de2ae9d15c2345e51458afc1659 (diff)
Make overriding cnf-handler work
See #1925: This allows users to disable the cnf-logic which can be quite slow on small hardware (like a raspberry pi). Squashed commit of the following: commit 742a59e30d8db24b6bb5067d4204d4b5cc01c1c3 Author: Fabian Homborg <FHomborg@gmail.com> Date: Sun Aug 30 18:23:41 2015 +0200 Erase startup cnf-handler early Simplifies the code a bit - in particular it removes the special-casing from the startup handler. commit 638a97e7f31f302b65e044c93c638c03a69e31f5 Author: Fabian Homborg <FHomborg@gmail.com> Date: Mon Aug 24 20:14:46 2015 +0200 Make overriding cnf-handler work Do this by renaming the __fish_command_not_found_handler used during startup to __fish_startup_command_not_found_handler. That allows us to check if __fish_command_not_found_handler has been defined and skip the setup of the normal one. Now disabling cnf-handling can be done via defining an empty __fish_command_not_found_handler in config.fish
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r--share/functions/__fish_config_interactive.fish12
1 files changed, 7 insertions, 5 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index fa1e140d..e9e2d912 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -196,17 +196,19 @@ function __fish_config_interactive -d "Initializations that should be performed
end
end
- # 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
+ # Remove the startup command_not_found handler since we're done with it
+ functions -e __fish_startup_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
+ # If the user defined a handler, it takes precedence
+ # It does not need to be executed because it's been defined before the event
+ if type -q __fish_command_not_found_handler
+ return 0
+ end
# First check if we are on OpenSUSE since SUSE's handler has no options
# and expects first argument to be a command and second database
# also check if there is command-not-found command.