diff --git a/rc/tools/grep.kak b/rc/tools/grep.kak index eb6eed10..d9738842 100644 --- a/rc/tools/grep.kak +++ b/rc/tools/grep.kak @@ -52,11 +52,14 @@ declare-option -docstring "name of the client in which all source code jumps wil str jumpclient define-command -hidden grep-jump %{ - evaluate-commands %{ # use evaluate-commands to ensure jumps are collapsed + evaluate-commands -save-regs a %{ # use evaluate-commands to ensure jumps are collapsed try %{ - execute-keys 'xs^([^:\n]+):(\d+):(\d+)?' + evaluate-commands -draft %{ + execute-keys ',xs^([^:\n]+):(\d+):(\d+)?' + set-register a %reg{1} %reg{2} %reg{3} + } set-option buffer grep_current_line %val{cursor_line} - evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing %reg{1} %reg{2} %reg{3} + evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing -- %reg{a} try %{ focus %opt{jumpclient} } } } diff --git a/rc/tools/make.kak b/rc/tools/make.kak index 85260bc6..5d4813d3 100644 --- a/rc/tools/make.kak +++ b/rc/tools/make.kak @@ -52,19 +52,23 @@ define-command -hidden make-open-error -params 4 %{ } define-command -hidden make-jump %{ - evaluate-commands -save-regs / %{ - try %{ - execute-keys gl "Entering directory" - # Try to parse the error into capture groups, failing on absolute paths - execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" l - 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 / %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}" + evaluate-commands -save-regs a/ %{ + evaluate-commands -draft %{ + execute-keys , + try %{ + execute-keys gl "Entering directory" + # Try to parse the error into capture groups, failing on absolute paths + execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" l + set-option buffer make_current_error_line %val{cursor_line} + set-register a "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}" + } catch %{ + set-register / %opt{make_error_pattern} + execute-keys sl + set-option buffer make_current_error_line %val{cursor_line} + set-register a "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}" + } } + make-open-error %reg{a} } }