diff --git a/share/config.fish b/share/config.fish index 85d7ba09a..dddecae2a 100644 --- a/share/config.fish +++ b/share/config.fish @@ -105,6 +105,13 @@ if not contains -- $__fish_data_dir/completions $fish_complete_path set fish_complete_path $fish_complete_path $__fish_data_dir/completions end +# : is a sh/bash-compatibility function, but because its name can cause problems on many +# systems, it is saved as colon.fish and not :.fish, which means that it's never autoloaded +# since the name of the file and the name of the function differ. Force evaluation of colon.fish +# as a function by simply trying to load the non-existent function colon, which will pull in +# colon.fish and lead to `:` being recognized. Sourced up here so it can be used later safely. +type -q colon; or true # just to reset $status + # # This is a Solaris-specific test to modify the PATH so that # Posix-conformant tools are used by default. It is separate from the diff --git a/src/env.cpp b/src/env.cpp index 1850160c3..67cf0fbe7 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -746,12 +746,6 @@ static void setup_user(bool force) { } } -void misc_init_with_paths() { - // Since ':' can cause problems in filenames, the : function is saved to colon.fish - // But that means it isn't autoloaded since the name doesn't match the function. - bool loaded = function_load(L"colon"); -} - /// Various things we need to initialize at run-time that don't really fit any of the other init /// routines. void misc_init() { @@ -769,7 +763,7 @@ void misc_init() { // MS Windows tty devices do not currently have either a read or write timestamp. Those // respective fields of `struct stat` are always the current time. Which means we can't // use them. So we assume no external program has written to the terminal behind our - // back. This makes multiline prompt usable. See issue #2859 and + // back. This makes multiline promptusable. See issue #2859 and // https://github.com/Microsoft/BashOnWindows/issues/545 has_working_tty_timestamps = false; #endif diff --git a/src/env.h b/src/env.h index 7f6050e5e..543b4dd11 100644 --- a/src/env.h +++ b/src/env.h @@ -67,8 +67,6 @@ void env_init(const struct config_paths_t *paths = NULL); /// Various things we need to initialize at run-time that don't really fit any of the other init /// routines. void misc_init(); -/// Same as misc_init() but after configuration paths have been loaded -void misc_init_with_paths(); class env_var_t { private: diff --git a/src/fish.cpp b/src/fish.cpp index 2568a4558..5568086b7 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -384,9 +384,6 @@ int main(int argc, char **argv) { const io_chain_t empty_ios; if (read_init(paths)) { - // Additional initialization that must occur after paths are loaded - misc_init_with_paths(); - // Stomp the exit status of any initialization commands (issue #635). proc_set_last_status(STATUS_CMD_OK); diff --git a/src/function.cpp b/src/function.cpp index 8d0ab1d12..f15b06739 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -194,13 +194,11 @@ int function_exists(const wcstring &cmd) { return loaded_functions.find(cmd) != loaded_functions.end(); } -bool function_load(const wcstring &cmd) { +void function_load(const wcstring &cmd) { if (!parser_keywords_is_reserved(cmd)) { scoped_rlock locker(functions_lock); - return load(cmd) == 0; + load(cmd); } - - return false; //not loaded } int function_exists_no_autoload(const wcstring &cmd, const env_vars_snapshot_t &vars) { diff --git a/src/function.h b/src/function.h index d72d9453f..5adfabb18 100644 --- a/src/function.h +++ b/src/function.h @@ -74,7 +74,7 @@ void function_set_desc(const wcstring &name, const wcstring &desc); int function_exists(const wcstring &name); /// Attempts to load a function if not yet loaded. This is used by the completion machinery. -bool function_load(const wcstring &name); +void function_load(const wcstring &name); /// Returns true if the function with the name name exists, without triggering autoload. int function_exists_no_autoload(const wcstring &name, const env_vars_snapshot_t &vars);