From c54a8ef987a1b2a15fe7ccd7be816b0a2de09fc3 Mon Sep 17 00:00:00 2001 From: Paul d'Hubert Date: Tue, 6 Dec 2016 15:47:03 +0100 Subject: [PATCH 1/2] Allow setting custom make error pattern The current pattern used by the commands `make-next` and `make-prev` are not suitable for all usages. For example the go compiler will not suffix errors with `error: ` and is not usable with these functions. This change allows the user to define a custom error pattern, instead of having to work around the error (for example using sed to insert the `error: ` suffix). What do you think of this? I have not followed the current convention of having options without separators (like `makecmd`). Also this does not feel to be the right solution because the pattern has to be set at global level. --- rc/core/make.kak | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rc/core/make.kak b/rc/core/make.kak index f53cb272..76d77b0c 100644 --- a/rc/core/make.kak +++ b/rc/core/make.kak @@ -1,4 +1,6 @@ decl str makecmd make +decl str make_error_pattern "[0-9]+: (?:fatal )?error:" + decl str toolsclient decl -hidden int _make_current_error_line @@ -59,7 +61,7 @@ def -hidden make-jump %{ def make-next -docstring 'Jump to the next make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' - exec "%opt{_make_current_error_line}g/[0-9]+: (?:fatal )?error:" + exec "%opt{_make_current_error_line}g/%opt{make_error_pattern}" make-jump } try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } } @@ -68,7 +70,7 @@ def make-next -docstring 'Jump to the next make error' %{ def make-prev -docstring 'Jump to the previous make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' - exec "%opt{_make_current_error_line}g[0-9]+: (?:fatal )?error:" + exec "%opt{_make_current_error_line}g%opt{make_error_pattern}" make-jump } try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } } From 010453a2ace1038b07e636fb782653055565a031 Mon Sep 17 00:00:00 2001 From: Paul d'Hubert Date: Thu, 8 Dec 2016 11:33:28 +0100 Subject: [PATCH 2/2] Update make.rc error pattern matching - Use the classic unix file:line:(col:)? pattern for matching. - The option `make_error_pattern` can be used to further restrict errors to be matched (to include / exclude warnings, etc. --- rc/core/make.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/core/make.kak b/rc/core/make.kak index 76d77b0c..c446eb09 100644 --- a/rc/core/make.kak +++ b/rc/core/make.kak @@ -1,5 +1,5 @@ decl str makecmd make -decl str make_error_pattern "[0-9]+: (?:fatal )?error:" +decl str make_error_pattern " (?:fatal )?error:" decl str toolsclient decl -hidden int _make_current_error_line @@ -61,7 +61,7 @@ def -hidden make-jump %{ def make-next -docstring 'Jump to the next make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' - exec "%opt{_make_current_error_line}g/%opt{make_error_pattern}" + exec "%opt{_make_current_error_line}g/(?:\w:)?[^:]+:\d+:(?:\d+:)?%opt{make_error_pattern}" make-jump } try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } } @@ -70,7 +70,7 @@ def make-next -docstring 'Jump to the next make error' %{ def make-prev -docstring 'Jump to the previous make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' - exec "%opt{_make_current_error_line}g%opt{make_error_pattern}" + exec "%opt{_make_current_error_line}g(?:\w:)?[^:]+:\d+:(?:\d+:)?%opt{make_error_pattern}" make-jump } try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } }