add KakBegin and KakEnd hooks

This commit is contained in:
Maxime Coste 2013-04-19 13:45:44 +02:00
parent ca69981cc6
commit 38bd8c243f
2 changed files with 13 additions and 0 deletions

View File

@ -407,6 +407,9 @@ existing hooks are:
* +BufCreate+: A buffer has been created, filename is used for filtering
* +RuntimeError+: an error was encountered while executing an user command
the error message is used for filtering
* +KakBegin+: Kakoune started, this is called just after reading the user
configuration files
* +KakEnd+: Kakoune is quitting.
when not specified, the filtering text is an empty string.

View File

@ -243,6 +243,11 @@ int main(int argc, char* argv[])
write_debug("error while parsing kakrc: asked to quit");
}
{
Context empty_context;
global_hooks.run_hook("KakBegin", "", empty_context);
}
if (parser.positional_count() != 0)
{
// create buffers in reverse order so that the first given buffer
@ -261,6 +266,11 @@ int main(int argc, char* argv[])
while (not client_manager.empty())
event_manager.handle_next_events();
{
Context empty_context;
global_hooks.run_hook("KakEnd", "", empty_context);
}
}
catch (Kakoune::exception& error)
{