rc/make.kak avoid another using pattern directly

This commit is contained in:
Bob Qi 2023-10-27 10:14:59 +08:00
parent 8e5ca3f214
commit cb540def46

View File

@ -54,7 +54,6 @@ define-command -hidden make-open-error -params 4 %{
define-command -hidden make-jump %{ define-command -hidden make-jump %{
evaluate-commands -save-regs / %{ 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 %{ try %{
execute-keys gl<a-?> "Entering directory" <ret><a-:> execute-keys gl<a-?> "Entering directory" <ret><a-:>
# Try to parse the error into capture groups, failing on absolute paths # 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} set-option buffer make_current_error_line %val{cursor_line}
make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
} catch %{ } catch %{
execute-keys <a-h><a-l> s "%reg{/}([^\n]+)?\z" <ret>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 <a-h><a-l> s<ret>l
set-option buffer make_current_error_line %val{cursor_line} set-option buffer make_current_error_line %val{cursor_line}
make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
} }