summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-04-11 11:37:18 +1000
committerMaxime Coste <mawww@kakoune.org>2024-04-12 15:28:40 +1000
commit3d7d0fecca885b00a7ae80180ea1841fab2c5993 (patch)
tree94218f4a6dab3f448ceaff034e51079a0ecc2e3c /rc
parentb1c114bf6d950684df0524e450782a151e6a0323 (diff)
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
Diffstat (limited to 'rc')
-rw-r--r--rc/windowing/detection.kak25
1 files changed, 1 insertions, 24 deletions
diff --git a/rc/windowing/detection.kak b/rc/windowing/detection.kak
index ebdaf208..2fde81cd 100644
--- a/rc/windowing/detection.kak
+++ b/rc/windowing/detection.kak
@@ -48,7 +48,7 @@ define-command terminal -params 1.. -docstring %{
Example usage:
terminal sh
- with-option windowing_placement horizontal terminal sh
+ evaluate-commands %{ set local windowing_placement horizontal; terminal sh }
See also the 'new' command.
} %{
@@ -56,29 +56,6 @@ define-command terminal -params 1.. -docstring %{
}
complete-command terminal shell
-# TODO Move this?
-define-command with-option -params 3.. -docstring %{
- with-option <option_name> <new_value> <command> [<arguments>]: evaluate a command with a modified option
-} %{
- evaluate-commands -save-regs s %{
- evaluate-commands set-register s %exp{%%opt{%arg{1}}}
- set-option current %arg{1} %arg{2}
- try %{
- evaluate-commands %sh{
- shift 2
- for arg
- do
- printf "'%s' " "$(printf %s "$arg" | sed "s/'/''/g")"
- done
- }
- } catch %{
- set-option current %arg{1} %reg{s}
- fail "with-option: %val{error}"
- }
- set-option current %arg{1} %reg{s}
- }
-}
-
hook -group windowing global KakBegin .* %{
evaluate-commands %sh{
set -- ${kak_opt_windowing_modules}