make.kak: Fix echoing of error message when jumping

The use of `%{...%reg{...}}` was not being expanded correctly, as
the enclosing %{...} prevents the internal %expand{...} from being
considered.

The introduction of an additional command allows us to bypass
quoting hell as the expansion of %reg{5} could contain arbitrary
text.
This commit is contained in:
Maxime Coste 2018-02-19 21:43:43 +11:00
parent cbf11d7a07
commit 9755f7f8f2

View File

@ -46,6 +46,14 @@ hook global WinSetOption filetype=(?!make).* %{
declare-option -docstring "name of the client in which all source code jumps will be executed" \
str jumpclient
define-command -hidden make-open-error -params 4 %{
evaluate-commands -try-client %opt{jumpclient} %{
edit -existing "%arg{1}" %arg{2} %arg{3}
echo -markup "{Information}%arg{4}"
try %{ focus }
}
}
define-command -hidden make-jump %{
evaluate-commands -collapse-jumps %{
try %{
@ -53,11 +61,11 @@ define-command -hidden make-jump %{
# Try to parse the error into capture groups, failing on absolute paths
execute-keys s "Entering directory '([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
set-option buffer make_current_error_line %val{cursor_line}
evaluate-commands -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -markup %{{Information}%reg{5}}; try %{ focus }"
make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
} catch %{
execute-keys <a-h><a-l> s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
set-option buffer make_current_error_line %val{cursor_line}
evaluate-commands -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -markup %{{Information}%reg{4}}; try %{ focus }"
make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
}
}
}