From 15bb048428c057bd4f11e60452cf7f6c5a0a9e76 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 18 Feb 2015 13:55:47 +0000 Subject: [PATCH] clang.kak: use trap to remove the temporary directory, fix escaping problems --- rc/clang.kak | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc/clang.kak b/rc/clang.kak index e961cfee..91bd3aff 100644 --- a/rc/clang.kak +++ b/rc/clang.kak @@ -26,6 +26,8 @@ def -shell-params clang-parse %{ # position and a buffer timestamp, only valid completions should be # displayed. ( + trap "rm -r ${dir}" EXIT + case ${kak_opt_filetype} in cpp) ft=c++ ;; obj-c) ft=objective-c ;; @@ -71,14 +73,12 @@ def -shell-params clang-parse %{ " | paste -s -d ':') errors=$(cat ${dir}/stderr | sed -rne " - /^:[0-9]+:([0-9]+:)? (error|warning)/ { s/^:([0-9]+):([0-9]+:)? (.*)/\1,\3/; p }") + /^:[0-9]+:([0-9]+:)? (error|warning)/ { s/^:([0-9]+):([0-9]+:)? (.*)/\1,\3/; s/'/\\\\'/g; p }") sed -e "s||${kak_bufname}|g" < ${dir}/stderr > ${dir}/fifo echo "set 'buffer=${kak_buffile}' clang_flags %{${flags}} - set 'buffer=${kak_buffile}' clang_errors %{${errors}}" | kak -p ${kak_session} - - rm -r ${dir} + set 'buffer=${kak_buffile}' clang_errors '${errors}'" | kak -p ${kak_session} ) > /dev/null 2>&1 < /dev/null & } }