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/scope.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/scope.cc') diff --git a/src/scope.cc b/src/scope.cc index 64bcd445..fe33f6f5 100644 --- a/src/scope.cc +++ b/src/scope.cc @@ -4,6 +4,16 @@ namespace Kakoune { +void Scope::reparent(Scope& parent) +{ + m_options.reparent(parent.m_options); + m_hooks.reparent(parent.m_hooks); + m_keymaps.reparent(parent.m_keymaps); + m_aliases.reparent(parent.m_aliases); + m_faces.reparent(parent.m_faces); + m_highlighters.reparent(parent.m_highlighters); +} + GlobalScope::GlobalScope() : m_option_registry(m_options) { -- cgit v1.2.3