diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-04-11 11:37:18 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-04-12 15:28:40 +1000 |
| commit | 3d7d0fecca885b00a7ae80180ea1841fab2c5993 (patch) | |
| tree | 94218f4a6dab3f448ceaff034e51079a0ecc2e3c /doc | |
| parent | b1c114bf6d950684df0524e450782a151e6a0323 (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 'doc')
| -rw-r--r-- | doc/pages/execeval.asciidoc | 5 | ||||
| -rw-r--r-- | doc/pages/scopes.asciidoc | 22 |
2 files changed, 21 insertions, 6 deletions
diff --git a/doc/pages/execeval.asciidoc b/doc/pages/execeval.asciidoc index 4606c634..98ad8cf0 100644 --- a/doc/pages/execeval.asciidoc +++ b/doc/pages/execeval.asciidoc @@ -64,3 +64,8 @@ are then restored when the keys have been executed: */*, *"*, *|*, *^*, *-with-hooks*:: Execute keys and trigger existing hooks. (See <<hooks#,`:doc hooks`>>) + +== Local scope in *evaluate-commands* + +When using *evaluate-commands* a new scope, named `local` is inserted. +See <<scopes#,`:doc scopes`>> diff --git a/doc/pages/scopes.asciidoc b/doc/pages/scopes.asciidoc index b6711278..02bb5470 100644 --- a/doc/pages/scopes.asciidoc +++ b/doc/pages/scopes.asciidoc @@ -36,15 +36,25 @@ Scopes are named as follows: *global*:: global context linked to the instance of Kakoune +*local*:: + A local scope is inserted by each *evaluate-commands* invocations + for its duration. Nested *evaluate-commands* each inject a new + local scope whose parent is the previous local scope. + + A local scope is intended for temporarily overwriting some scoped + value, such as an option or an alias. + + The following order of priority applies to the above scopes: --------------------------- -window ]> buffer ]> global --------------------------- +----------------------------------- +local ]> window ]> buffer ]> global +----------------------------------- -The above priority line implies that objects can have individual values that -will be resolved first in the *window* scope (highest priority), then in -the *buffer* scope, and finally in the *global* scope (lowest priority). +The above priority line implies that objects can have individual values +that will be resolved first in the *local* scope (if it exists), then the +*window* scope, then in the *buffer* scope, and finally in the *global* +scope. Normally, the *buffer* scope keyword means the scope associated with the currently active buffer, but it's possible to specify any existing buffer by |
