From d0571ce2383e9e4dbffd6ccf50e6dc18b43241b3 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Thu, 26 Oct 2023 10:13:07 +0800 Subject: rc/make.kak support override the whole error line pattern --- rc/tools/make.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index a150480b..5b1e7779 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -1,7 +1,7 @@ declare-option -docstring "shell command run to build the project" \ str makecmd make declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \ - str make_error_pattern " (?:fatal )?error:" + str make_error_pattern "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)? (?:fatal )?error:" declare-option -docstring "name of the client in which utilities display information" \ str toolsclient @@ -69,7 +69,7 @@ define-command -hidden make-jump %{ define-command make-next-error -docstring 'Jump to the next make error' %{ evaluate-commands -try-client %opt{jumpclient} %{ buffer '*make*' - execute-keys "%opt{make_current_error_line}ggl" "/^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}" + execute-keys "%opt{make_current_error_line}ggl" "/%opt{make_error_pattern}" make-jump } try %{ @@ -83,7 +83,7 @@ define-command make-next-error -docstring 'Jump to the next make error' %{ define-command make-previous-error -docstring 'Jump to the previous make error' %{ evaluate-commands -try-client %opt{jumpclient} %{ buffer '*make*' - execute-keys "%opt{make_current_error_line}g" "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}" + execute-keys "%opt{make_current_error_line}g" "%opt{make_error_pattern}" make-jump } try %{ -- cgit v1.2.3 From 2d849cc147ad7de54d3070ad3f80c78cc86352a7 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Fri, 27 Oct 2023 08:25:38 +0800 Subject: rc/make.kak set search register to avoid injection --- rc/tools/make.kak | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 5b1e7779..74e16864 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -67,9 +67,10 @@ define-command -hidden make-jump %{ } define-command make-next-error -docstring 'Jump to the next make error' %{ - evaluate-commands -try-client %opt{jumpclient} %{ + evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - execute-keys "%opt{make_current_error_line}ggl" "/%opt{make_error_pattern}" + set-register / %opt{make_error_pattern} + execute-keys "%opt{make_current_error_line}ggl" "/" make-jump } try %{ @@ -81,9 +82,10 @@ define-command make-next-error -docstring 'Jump to the next make error' %{ } define-command make-previous-error -docstring 'Jump to the previous make error' %{ - evaluate-commands -try-client %opt{jumpclient} %{ + evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - execute-keys "%opt{make_current_error_line}g" "%opt{make_error_pattern}" + set-register / %opt{make_error_pattern} + execute-keys "%opt{make_current_error_line}g" "" make-jump } try %{ -- cgit v1.2.3 From 8e5ca3f214451e20a72a1593d476d741960f52b5 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Fri, 27 Oct 2023 09:54:41 +0800 Subject: rc/make.kak introduce a new option to be back compatible --- rc/tools/make.kak | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 74e16864..1e806edf 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -1,7 +1,9 @@ declare-option -docstring "shell command run to build the project" \ str makecmd make +declare-option -docstring "pattern that find lines containing information about errors in the output of the `makecmd` command" \ + str make_error_pattern " (?:fatal )?error:" declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \ - str make_error_pattern "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)? (?:fatal )?error:" + str make_error_line_pattern "" declare-option -docstring "name of the client in which utilities display information" \ str toolsclient @@ -51,7 +53,8 @@ define-command -hidden make-open-error -params 4 %{ } define-command -hidden make-jump %{ - evaluate-commands %{ + evaluate-commands -save-regs / %{ + set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } try %{ execute-keys gl "Entering directory" # Try to parse the error into capture groups, failing on absolute paths @@ -59,7 +62,7 @@ define-command -hidden make-jump %{ set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" } catch %{ - execute-keys s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" l + execute-keys s "%reg{/}([^\n]+)?\z" l set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" } @@ -69,7 +72,7 @@ define-command -hidden make-jump %{ define-command make-next-error -docstring 'Jump to the next make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %opt{make_error_pattern} + set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } execute-keys "%opt{make_current_error_line}ggl" "/" make-jump } @@ -84,7 +87,7 @@ define-command make-next-error -docstring 'Jump to the next make error' %{ define-command make-previous-error -docstring 'Jump to the previous make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %opt{make_error_pattern} + set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } execute-keys "%opt{make_current_error_line}g" "" make-jump } -- cgit v1.2.3 From cb540def4634952c67909d5a8fd74d58c07e6e6b Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Fri, 27 Oct 2023 10:14:59 +0800 Subject: rc/make.kak avoid another using pattern directly --- rc/tools/make.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 1e806edf..ab51090b 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -54,7 +54,6 @@ define-command -hidden make-open-error -params 4 %{ define-command -hidden make-jump %{ evaluate-commands -save-regs / %{ - set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } try %{ execute-keys gl "Entering directory" # Try to parse the error into capture groups, failing on absolute paths @@ -62,7 +61,8 @@ define-command -hidden make-jump %{ set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" } catch %{ - execute-keys s "%reg{/}([^\n]+)?\z" l + set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?${kak_opt_make_error_pattern}([^\n]+)?\z" ; else printf %s "${kak_opt_make_error_line_pattern}([^\n]+)?\z"; fi } + execute-keys sl set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" } -- cgit v1.2.3 From 760f63b8276533fb9b728c294a8c5f27b2ef51b4 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Sun, 29 Oct 2023 08:27:03 +0800 Subject: rc/make.kak set option type to be regex --- rc/tools/make.kak | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index ab51090b..37a0766e 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -1,9 +1,10 @@ declare-option -docstring "shell command run to build the project" \ str makecmd make -declare-option -docstring "pattern that find lines containing information about errors in the output of the `makecmd` command" \ +declare-option -hidden -docstring "pattern that find lines containing information about errors in the output of the `makecmd` command" \ str make_error_pattern " (?:fatal )?error:" -declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \ - str make_error_line_pattern "" +declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command. Capture groups must be: 1: filename 2: line number 3: optional column 4: optional error description" \ + regex make_error_line_pattern "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?" + declare-option -docstring "name of the client in which utilities display information" \ str toolsclient @@ -61,7 +62,7 @@ define-command -hidden make-jump %{ set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" } catch %{ - set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?${kak_opt_make_error_pattern}([^\n]+)?\z" ; else printf %s "${kak_opt_make_error_line_pattern}([^\n]+)?\z"; fi } + set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)?${kak_opt_make_error_pattern}([^\n]+)?\z" ; else printf %s "${kak_opt_make_error_line_pattern}"; fi } execute-keys sl set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" @@ -72,7 +73,7 @@ define-command -hidden make-jump %{ define-command make-next-error -docstring 'Jump to the next make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } + set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } execute-keys "%opt{make_current_error_line}ggl" "/" make-jump } @@ -87,7 +88,7 @@ define-command make-next-error -docstring 'Jump to the next make error' %{ define-command make-previous-error -docstring 'Jump to the previous make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %sh{ if [ -z "$kak_opt_make_error_line_pattern" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } + set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } execute-keys "%opt{make_current_error_line}g" "" make-jump } -- cgit v1.2.3 From 8424fbe0f0fd7a121bcf67255cdfc73d6ef7c561 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Thu, 2 Nov 2023 09:11:18 +0800 Subject: rc/make.kak reuse make_error_pattern --- rc/tools/make.kak | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 37a0766e..121df42c 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -1,9 +1,7 @@ declare-option -docstring "shell command run to build the project" \ str makecmd make -declare-option -hidden -docstring "pattern that find lines containing information about errors in the output of the `makecmd` command" \ - str make_error_pattern " (?:fatal )?error:" declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command. Capture groups must be: 1: filename 2: line number 3: optional column 4: optional error description" \ - regex make_error_line_pattern "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?" + regex make_error_pattern "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)? (?:fatal )?error:([^\n]+)?" declare-option -docstring "name of the client in which utilities display information" \ @@ -62,7 +60,7 @@ define-command -hidden make-jump %{ set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" } catch %{ - set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?([^:\n]+):(\d+):(?:(\d+):)?${kak_opt_make_error_pattern}([^\n]+)?\z" ; else printf %s "${kak_opt_make_error_line_pattern}"; fi } + set-register / %opt{make_error_pattern} execute-keys sl set-option buffer make_current_error_line %val{cursor_line} make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" @@ -73,7 +71,7 @@ define-command -hidden make-jump %{ define-command make-next-error -docstring 'Jump to the next make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } + set-register / %opt{make_error_pattern} execute-keys "%opt{make_current_error_line}ggl" "/" make-jump } @@ -88,7 +86,7 @@ define-command make-next-error -docstring 'Jump to the next make error' %{ define-command make-previous-error -docstring 'Jump to the previous make error' %{ evaluate-commands -try-client %opt{jumpclient} -save-regs / %{ buffer '*make*' - set-register / %sh{ if [ "$kak_opt_make_error_pattern" != " (?:fatal )?error:" ] ; then printf %s "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?$kak_opt_make_error_pattern" ; else printf %s "$kak_opt_make_error_line_pattern"; fi } + set-register / %opt{make_error_pattern} execute-keys "%opt{make_current_error_line}g" "" make-jump } -- cgit v1.2.3