From 37ba96e6f2d1c85aa151fc09c1b6bab5e5d8eed2 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 22 May 2025 10:28:31 +0200 Subject: [PATCH 1/7] Added note --- .../src/docs/user/customization.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index 871c9cb734..c9bcfbe9cc 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -204,3 +204,36 @@ _You can disable the default Cursorless reformat command by prefixing the spoken form : user.cursorless_reformat(cursorless_target, formatters) ``` + +### Experimental custom command action + +_NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future_ + +`user.cursorless_custom_command(command: string, *args)` + +Run a custom Cursorless command by parsing the specified command string. + +- Utilizes default Cursorless spoken forms in the command string. +- Optional target arguments can be interpolated in the command string. + +#### Examples + +`"scratch"` => `"chuck block"` + +```talon +scratch: user.cursorless_custom_command("chuck block") +``` + +`"scratch air"` => `"chuck block air"` + +```talon +scratch : + user.cursorless_custom_command("chuck block ", cursorless_target) +``` + +`"combine air plus bat"` => `"bring block air after bat"` + +```talon +combine plus : + user.cursorless_custom_command("bring block after ", cursorless_target_1, cursorless_target_2) +``` From f78ee2448f57364080bd521f6c06e641009e433d Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Thu, 29 May 2025 11:41:30 +0100 Subject: [PATCH 2/7] Update customization.md --- .../cursorless-org-docs/src/docs/user/customization.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index c9bcfbe9cc..04f807775b 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -211,27 +211,27 @@ _NOTE that this feature is experimental. Not as thoroughly tested as the rest of `user.cursorless_custom_command(command: string, *args)` -Run a custom Cursorless command by parsing the specified command string. +Run a custom Cursorless command by parsing the specified command string. Supports a subset of the Cursorless grammar, with **default** spoken forms (not your custom spoken forms). See https://www.cursorless.org/custom-command-railroad to see the subset of our grammar that we support today. - Utilizes default Cursorless spoken forms in the command string. -- Optional target arguments can be interpolated in the command string. +- Optional target arguments can be interpolated in the command string. (see examples below) #### Examples -`"scratch"` => `"chuck block"` +In order to map `"scratch"` to perform `"chuck block"`: ```talon scratch: user.cursorless_custom_command("chuck block") ``` -`"scratch air"` => `"chuck block air"` +To map `"scratch air"` => `"chuck block air"` ```talon scratch : user.cursorless_custom_command("chuck block ", cursorless_target) ``` -`"combine air plus bat"` => `"bring block air after bat"` +To map `"combine air plus bat"` => `"bring block air after bat"` ```talon combine plus : From 7e31dd871e9dba1eb30988999e0d8e0f07c46084 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 31 May 2025 05:54:05 +0200 Subject: [PATCH 3/7] Update action name --- cursorless-talon-dev/src/cursorless_test.talon | 6 +++--- cursorless-talon/src/public_api.py | 2 +- .../cursorless-org-docs/src/docs/user/customization.md | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cursorless-talon-dev/src/cursorless_test.talon b/cursorless-talon-dev/src/cursorless_test.talon index 339c642110..914f7d2aea 100644 --- a/cursorless-talon-dev/src/cursorless_test.talon +++ b/cursorless-talon-dev/src/cursorless_test.talon @@ -32,8 +32,8 @@ test api extract decorated marks : test api alternate highlight nothing: user.private_cursorless_test_alternate_highlight_nothing() -test api parsed: user.cursorless_custom_command("chuck block") +test api parsed: user.cursorless_x_custom_command("chuck block") test api parsed : - user.cursorless_custom_command("chuck block ", cursorless_target) + user.cursorless_x_custom_command("chuck block ", cursorless_target) test api parsed plus : - user.cursorless_custom_command("bring block after ", cursorless_target_1, cursorless_target_2) + user.cursorless_x_custom_command("bring block after ", cursorless_target_1, cursorless_target_2) diff --git a/cursorless-talon/src/public_api.py b/cursorless-talon/src/public_api.py index c332ad1cf3..cf5bc07838 100644 --- a/cursorless-talon/src/public_api.py +++ b/cursorless-talon/src/public_api.py @@ -26,7 +26,7 @@ def cursorless_create_destination( @mod.action_class class CommandActions: - def cursorless_custom_command( + def cursorless_x_custom_command( content: str, # pyright: ignore [reportGeneralTypeIssues] arg1: Optional[Any] = None, arg2: Optional[Any] = None, diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index 04f807775b..1b780fc713 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -209,7 +209,7 @@ _You can disable the default Cursorless reformat command by prefixing the spoken _NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future_ -`user.cursorless_custom_command(command: string, *args)` +`user.cursorless_x_custom_command(command: string, *args)` Run a custom Cursorless command by parsing the specified command string. Supports a subset of the Cursorless grammar, with **default** spoken forms (not your custom spoken forms). See https://www.cursorless.org/custom-command-railroad to see the subset of our grammar that we support today. @@ -221,19 +221,19 @@ Run a custom Cursorless command by parsing the specified command string. Support In order to map `"scratch"` to perform `"chuck block"`: ```talon -scratch: user.cursorless_custom_command("chuck block") +scratch: user.cursorless_x_custom_command("chuck block") ``` To map `"scratch air"` => `"chuck block air"` ```talon scratch : - user.cursorless_custom_command("chuck block ", cursorless_target) + user.cursorless_x_custom_command("chuck block ", cursorless_target) ``` To map `"combine air plus bat"` => `"bring block air after bat"` ```talon combine plus : - user.cursorless_custom_command("bring block after ", cursorless_target_1, cursorless_target_2) + user.cursorless_x_custom_command("bring block after ", cursorless_target_1, cursorless_target_2) ``` From df3345a21e59aaee6195945199a3a7938c9d5cb8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 31 May 2025 11:01:46 +0200 Subject: [PATCH 4/7] Add reference to discussion --- packages/cursorless-org-docs/src/docs/user/customization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index 1b780fc713..ad1f09e975 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -207,7 +207,7 @@ _You can disable the default Cursorless reformat command by prefixing the spoken ### Experimental custom command action -_NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future_ +_NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes_ `user.cursorless_x_custom_command(command: string, *args)` From b38ab395fad2c442384275fa53ade4d8073b59b0 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 31 May 2025 15:12:52 +0200 Subject: [PATCH 5/7] Added warning --- packages/cursorless-org-docs/src/docs/user/customization.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index ad1f09e975..ef0307ea2e 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -207,7 +207,11 @@ _You can disable the default Cursorless reformat command by prefixing the spoken ### Experimental custom command action -_NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes_ +:::warning + +NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes\_ + +::: `user.cursorless_x_custom_command(command: string, *args)` From 7e4e1b0a4d1758724b436cb42baf283cf578ec56 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 31 May 2025 15:13:43 +0200 Subject: [PATCH 6/7] clean# Please enter the commit message for your changes. Lines starting --- packages/cursorless-org-docs/src/docs/user/customization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index ef0307ea2e..c2001689f2 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -209,7 +209,7 @@ _You can disable the default Cursorless reformat command by prefixing the spoken :::warning -NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes\_ +Note that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes\_ ::: From 038d999c41336dfa8087d929aa2675b053c9c0b1 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 31 May 2025 15:22:02 +0200 Subject: [PATCH 7/7] Cleanup --- packages/cursorless-org-docs/src/docs/user/customization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cursorless-org-docs/src/docs/user/customization.md b/packages/cursorless-org-docs/src/docs/user/customization.md index c2001689f2..ca9e1f088a 100644 --- a/packages/cursorless-org-docs/src/docs/user/customization.md +++ b/packages/cursorless-org-docs/src/docs/user/customization.md @@ -209,7 +209,7 @@ _You can disable the default Cursorless reformat command by prefixing the spoken :::warning -Note that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes\_ +This feature is experimental! Not as thoroughly tested as the rest of Cursorless and might change in the future. Early adopters should subscribe to this [discussion](https://github.com/cursorless-dev/cursorless/discussions/2942) to get updates about breaking changes\_ :::