Prevent the "funcinfo" command from printing errors

Add a try{} scope around the exec statement that raises errors when no
selection was possible/made.
This commit is contained in:
Frank LENORMAND 2015-08-03 21:50:50 +03:00
parent 38bb9fc3a8
commit 8beb1da552

View File

@ -36,12 +36,14 @@ def tag-complete -docstring "Insert completion candidates for the current select
def ctags-funcinfo -docstring "Display ctags information about a selected function" %{
eval -draft %{
exec '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>'
%sh{
sigs=$(readtags -e ${kak_selection%(} | grep kind:f | sed -re 's/^(\S+).*((class|struct|namespace):(\S+))?.*signature:(.*)$/\5 [\4::\1]/')
if [ -n "$sigs" ]; then
echo "eval -client ${kak_client} %{info -anchor $kak_cursor_line.$kak_cursor_column -placement above '$sigs'}"
fi
try %{
exec '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>'
%sh{
sigs=$(readtags -e ${kak_selection%(} | grep kind:f | sed -re 's/^(\S+).*((class|struct|namespace):(\S+))?.*signature:(.*)$/\5 [\4::\1]/')
if [ -n "$sigs" ]; then
echo "eval -client ${kak_client} %{info -anchor $kak_cursor_line.$kak_cursor_column -placement above '$sigs'}"
fi
}
}
}
}