Rename ModuleLoad hook to ModuleLoaded

This clarifies, that the hook is run *after* the module is loaded.
This commit is contained in:
codesoap 2019-06-25 17:48:24 +02:00
parent 196b38b2e0
commit ca2741fe20
6 changed files with 9 additions and 9 deletions

View File

@ -28,8 +28,8 @@ released versions.
`require-module` commands that allows for lazily loading language `require-module` commands that allows for lazily loading language
support files with dependency resolution. support files with dependency resolution.
* Added a new hook `ModuleLoad` which is run when a module is loaded, * Added a new hook `ModuleLoaded` which is run after a module is
allowing for module specific configuration. loaded, allowing for module specific configuration.
* Shell quoting of lists is not automatic anymore, `$kak_quoted_...` * Shell quoting of lists is not automatic anymore, `$kak_quoted_...`
makes it opt-in, and works for all option types. makes it opt-in, and works for all option types.

View File

@ -176,8 +176,8 @@ name. Hooks with no description will always use an empty string.
*RawKey* `key`:: *RawKey* `key`::
Triggered whenever a key is pressed by the user Triggered whenever a key is pressed by the user
*ModuleLoad* `module`:: *ModuleLoaded* `module`::
Triggered when a module is evaluated by the first `require-module` call Triggered after a module is evaluated by the first `require-module` call
Note that some hooks will not consider underlying scopes depending on what Note that some hooks will not consider underlying scopes depending on what
context they are bound to be run into, e.g. the `BufWritePost` hook is a buffer context they are bound to be run into, e.g. the `BufWritePost` hook is a buffer

View File

@ -1,7 +1,7 @@
# http://tmux.github.io/ # http://tmux.github.io/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook global ModuleLoad tmux %{ hook global ModuleLoaded tmux %{
require-module tmux-repl require-module tmux-repl
} }

View File

@ -1,4 +1,4 @@
hook global ModuleLoad x11 %{ hook global ModuleLoaded x11 %{
require-module x11-repl require-module x11-repl
} }

View File

@ -67,7 +67,7 @@ void CommandManager::load_module(StringView module_name, Context& context)
execute(module->value.commands, empty_context); execute(module->value.commands, empty_context);
module->value.commands.clear(); module->value.commands.clear();
context.hooks().run_hook(Hook::ModuleLoad, module_name, context); context.hooks().run_hook(Hook::ModuleLoaded, module_name, context);
} }
struct parse_error : runtime_error struct parse_error : runtime_error

View File

@ -57,7 +57,7 @@ enum class Hook
WinDisplay, WinDisplay,
WinResize, WinResize,
WinSetOption, WinSetOption,
ModuleLoad ModuleLoaded
}; };
constexpr auto enum_desc(Meta::Type<Hook>) constexpr auto enum_desc(Meta::Type<Hook>)
@ -103,7 +103,7 @@ constexpr auto enum_desc(Meta::Type<Hook>)
{Hook::WinDisplay, "WinDisplay"}, {Hook::WinDisplay, "WinDisplay"},
{Hook::WinResize, "WinResize"}, {Hook::WinResize, "WinResize"},
{Hook::WinSetOption, "WinSetOption"}, {Hook::WinSetOption, "WinSetOption"},
{Hook::ModuleLoad, "ModuleLoad"} {Hook::ModuleLoaded, "ModuleLoaded"}
}); });
} }