diff --git a/src/commands.cc b/src/commands.cc index d71ff183..543b14a5 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -395,7 +395,7 @@ void edit(const ParametersParser& parser, Context& context, const ShellContext&) if (parser.get_switch("readonly")) { buffer->flags() |= Buffer::Flags::ReadOnly; - buffer->options()["readonly"].set(true); + buffer->options().get_local_option("readonly").set(true); } } diff --git a/src/main.cc b/src/main.cc index fb0b165b..f3a4aef9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -781,8 +781,6 @@ int run_server(StringView session, StringView server_init, } #endif - GlobalScope::instance().options().get_local_option("readonly").set(flags & ServerFlags::ReadOnly); - bool startup_error = false; if (not (flags & ServerFlags::IgnoreKakrc)) try { @@ -824,7 +822,10 @@ int run_server(StringView session, StringView server_init, { Buffer *buffer = open_or_create_file_buffer(file); if (flags & ServerFlags::ReadOnly) + { buffer->flags() |= Buffer::Flags::ReadOnly; + buffer->options().get_local_option("readonly").set(true); + } } catch (runtime_error& error) {