diff --git a/src/context.cc b/src/context.cc index bd67a6b3..df8210f8 100644 --- a/src/context.cc +++ b/src/context.cc @@ -9,7 +9,6 @@ namespace Kakoune { -Context::Context() = default; Context::~Context() = default; Context::Context(InputHandler& input_handler, SelectionList selections, @@ -20,6 +19,8 @@ Context::Context(InputHandler& input_handler, SelectionList selections, m_name(std::move(name)) {} +Context::Context(EmptyContextFlag) {} + Buffer& Context::buffer() const { if (not has_buffer()) diff --git a/src/context.hh b/src/context.hh index 48b01a87..e2f45cc1 100644 --- a/src/context.hh +++ b/src/context.hh @@ -63,9 +63,11 @@ public: Transient = 1, }; - Context(); Context(InputHandler& input_handler, SelectionList selections, Flags flags, String name = ""); + + struct EmptyContextFlag {}; + explicit Context(EmptyContextFlag); ~Context(); Context(const Context&) = delete; diff --git a/src/main.cc b/src/main.cc index aa16ae5a..75610ca5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -385,7 +385,7 @@ int run_server(StringView session, StringView init_command, if (not ignore_kakrc) try { - Context initialisation_context; + Context initialisation_context{Context::EmptyContextFlag{}}; command_manager.execute("source " + runtime_directory() + "/kakrc", initialisation_context); } @@ -399,7 +399,7 @@ int run_server(StringView session, StringView init_command, } { - Context empty_context; + Context empty_context{Context::EmptyContextFlag{}}; global_scope.hooks().run_hook("KakBegin", "", empty_context); } @@ -439,7 +439,7 @@ int run_server(StringView session, StringView init_command, } { - Context empty_context; + Context empty_context{Context::EmptyContextFlag{}}; global_scope.hooks().run_hook("KakEnd", "", empty_context); } diff --git a/src/remote.cc b/src/remote.cc index 27394347..021e1edf 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -580,7 +580,7 @@ private: { if (not m_buffer.empty()) try { - Context context{}; + Context context{Context::EmptyContextFlag{}}; CommandManager::instance().execute(m_buffer, context); } catch (runtime_error& e)