From 3d7d0fecca885b00a7ae80180ea1841fab2c5993 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 11 Apr 2024 11:37:18 +1000 Subject: Introduce "local" scope in evaluate-commands When using `eval` a new scope named 'local' gets pushed for the whole evaluation, this makes it possible to temporarily set an option/hook/alias... Local scopes nest so nested evals do work as expected. Remove the now trivial with-option command --- src/insert_completer.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/insert_completer.cc') diff --git a/src/insert_completer.cc b/src/insert_completer.cc index c50fbe00..3e1bcd2d 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -403,7 +403,10 @@ InsertCompletion complete_line(const SelectionList& sels, } InsertCompleter::InsertCompleter(Context& context) - : m_context(context), m_options(context.options()), m_faces(context.faces()) + : m_context(context), + // local scopes might go away before completion ends, make sure to register on a long lived one + m_options(context.scope(false).options()), + m_faces(context.scope(false).faces()) { m_options.register_watcher(*this); } -- cgit v1.2.3