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.
This commit is contained in:
parent
03eb128536
commit
c54a8ef987
|
@ -1,4 +1,6 @@
|
||||||
decl str makecmd make
|
decl str makecmd make
|
||||||
|
decl str make_error_pattern "[0-9]+: (?:fatal )?error:"
|
||||||
|
|
||||||
decl str toolsclient
|
decl str toolsclient
|
||||||
decl -hidden int _make_current_error_line
|
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' %{
|
def make-next -docstring 'Jump to the next make error' %{
|
||||||
eval -collapse-jumps -try-client %opt{jumpclient} %{
|
eval -collapse-jumps -try-client %opt{jumpclient} %{
|
||||||
buffer '*make*'
|
buffer '*make*'
|
||||||
exec "%opt{_make_current_error_line}g<a-l>/[0-9]+: (?:fatal )?error:<ret>"
|
exec "%opt{_make_current_error_line}g<a-l>/%opt{make_error_pattern}<ret>"
|
||||||
make-jump
|
make-jump
|
||||||
}
|
}
|
||||||
try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } }
|
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' %{
|
def make-prev -docstring 'Jump to the previous make error' %{
|
||||||
eval -collapse-jumps -try-client %opt{jumpclient} %{
|
eval -collapse-jumps -try-client %opt{jumpclient} %{
|
||||||
buffer '*make*'
|
buffer '*make*'
|
||||||
exec "%opt{_make_current_error_line}g<a-h><a-/>[0-9]+: (?:fatal )?error:<ret>"
|
exec "%opt{_make_current_error_line}g<a-h><a-/>%opt{make_error_pattern}<ret>"
|
||||||
make-jump
|
make-jump
|
||||||
}
|
}
|
||||||
try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } }
|
try %{ eval -client %opt{toolsclient} %{ exec %opt{_make_current_error_line}g } }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user