From 3499d440dece32d56e63b5252e74d9bebfb33394 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 20 Mar 2016 16:37:58 +0000 Subject: [PATCH] Collapse jumps in grep.kak and make.kak --- rc/core/grep.kak | 16 +++++++++------- rc/core/make.kak | 28 +++++++++++++++------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/rc/core/grep.kak b/rc/core/grep.kak index 1bc5ef95..312ff67d 100644 --- a/rc/core/grep.kak +++ b/rc/core/grep.kak @@ -35,16 +35,18 @@ hook global WinSetOption filetype=(?!grep).* %{ rmhl grep; rmhooks buffer grep-h decl str jumpclient def grep-jump %{ - try %{ - exec 'xs^((?:\w:)?[^:]+):(\d+):(\d+)?' - set buffer _grep_current_line %val{cursor_line} - eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3} - try %{ focus %opt{jumpclient} } + eval -collapse-jumps %{ + try %{ + exec 'xs^((?:\w:)?[^:]+):(\d+):(\d+)?' + set buffer _grep_current_line %val{cursor_line} + eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3} + try %{ focus %opt{jumpclient} } + } } } def grep-next -docstring 'Jump to next grep match' %{ - eval -try-client %opt{jumpclient} %{ + eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*grep*' exec "%opt{_grep_current_line}g/^[^:]+:\d+:" grep-jump @@ -53,7 +55,7 @@ def grep-next -docstring 'Jump to next grep match' %{ } def grep-prev -docstring 'Jump to previous grep match' %{ - eval -try-client %opt{jumpclient} %{ + eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*grep*' exec "%opt{_grep_current_line}g^[^:]+:\d+:" grep-jump diff --git a/rc/core/make.kak b/rc/core/make.kak index 8f3a8fb5..ff796f19 100644 --- a/rc/core/make.kak +++ b/rc/core/make.kak @@ -32,22 +32,24 @@ hook global WinSetOption filetype=(?!make).* %{ rmhl make; rmhooks buffer make-h decl str jumpclient def make-jump -docstring 'Jump to error location' %{ - try %{ - exec gl "Entering directory" - exec s "Entering directory '([^']+)'.*\n([^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l - set buffer _make_current_error_line %val{cursor_line} - eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -color Information %{%reg{5}}" - try %{ focus %opt{jumpclient} } - } catch %{ - exec s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l - set buffer _make_current_error_line %val{cursor_line} - eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information %{%reg{4}}" - try %{ focus %opt{jumpclient} } + eval -collapse-jumps %{ + try %{ + exec gl "Entering directory" + exec s "Entering directory '([^']+)'.*\n([^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l + set buffer _make_current_error_line %val{cursor_line} + eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -color Information %{%reg{5}}" + try %{ focus %opt{jumpclient} } + } catch %{ + exec s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l + set buffer _make_current_error_line %val{cursor_line} + eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information %{%reg{4}}" + try %{ focus %opt{jumpclient} } + } } } def make-next -docstring 'Jump to next error' %{ - eval -try-client %opt{jumpclient} %{ + eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' exec "%opt{_make_current_error_line}g/[0-9]+: (?:fatal )?error:" make-jump @@ -56,7 +58,7 @@ def make-next -docstring 'Jump to next error' %{ } def make-prev -docstring 'Jump to previous error' %{ - eval -try-client %opt{jumpclient} %{ + eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' exec "%opt{_make_current_error_line}g[0-9]+: (?:fatal )?error:" make-jump