diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 74e16864d..1e806edfa 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 }