From 9755f7f8f28402476a3b43fe29fa51425acafd67 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 19 Feb 2018 21:43:43 +1100 Subject: [PATCH] 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. --- rc/core/make.kak | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rc/core/make.kak b/rc/core/make.kak index 34a1db0d..490adb63 100644 --- a/rc/core/make.kak +++ b/rc/core/make.kak @@ -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" 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 s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" 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}" } } }