From 5a6fb51bdb43f15eafdbe1078183f754b4fecdf6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 11 Jun 2024 19:39:07 +1000 Subject: Tweak python block command test location and remove wall of text We do not typically go into lengthy explanation of the code in the support scripts. This would have a performance impact (as comments are not trimmed in advance) and feels out of place. --- rc/filetype/python.kak | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'rc/filetype/python.kak') diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 4b1a9c76..5f42a7de 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -167,24 +167,7 @@ define-command -hidden python-insert-on-new-line %{ evaluate-commands -itersel - execute-keys try %{ evaluate-commands -draft -save-regs '/"' %{ - # Handle block comment continuation/termination. - # - # This code applies in the context where we have a new line - # inserted, and the previous line is a block comment (i.e. a line - # that matches '^\h*#+\h*\S*$'). We assume that the comment will - # be continued, so we copy the prefix (all leading whitespace, any - # '#' characters, and then any additional whitespace before the - # next non-whitespace character) into the new line. - # - # PEP8's text on block comments says they can include an empty - # comment (i.e. '^\h*#+\h*$') as a paragraph separator - we - # leave a single empty comment as-is, to allow paragraph breaks, - # but if we see two consecutive empty comments we exit the - # comment block and delete the empty comments. - # Reference: https://peps.python.org/pep-0008/#block-comments - # - # first, make sure we're in the right context - don't wrap this - # in a try/catch so we fail out immediately + # Ensure previous line is a comment execute-keys -draft kxs^\h*#+\h* # now handle the coment continuation logic -- cgit v1.2.3