From 866b3358c9e0c3c0b002f3442fc3bec260834673 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 3 Mar 2015 23:24:12 +0000 Subject: [PATCH] Fix clang.kak escaping, go back to a hook for removing tmp dir Previous trap based solution could end up with sh waiting on a closed fifo. --- rc/clang.kak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc/clang.kak b/rc/clang.kak index 703c466c..a99465b2 100644 --- a/rc/clang.kak +++ b/rc/clang.kak @@ -20,14 +20,16 @@ def -shell-params clang-parse %{ edit! -fifo ${dir}/fifo *clang-output* set buffer filetype make set buffer _make_current_error_line 0 + hook -group fifo buffer BufCloseFifo .* %{ + nop %sh{ rm -r ${dir} } + rmhooks buffer fifo + } }" # this runs in a detached shell, asynchronously, so that kakoune does # not hang while clang is running. As completions references a cursor # 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 ;; @@ -48,10 +50,8 @@ def -shell-params clang-parse %{ gsub(/ +$/, "", $3) id=substr($2, 1, length($2)-1) gsub(/:/, "\\:", id) - gsub(/"/, "\\\"", id) desc=$4 ? $3 "\\n" $4 : $3 gsub(/:/, "\\:", desc) - gsub(/"/, "\\\"", desc) if (id in completions) completions[id]=completions[id] "\\n" desc else @@ -60,9 +60,9 @@ def -shell-params clang-parse %{ END { for (id in completions) print id "@" completions[id] - }' | sort | paste -s -d ':' | sed -e 's/\\n/\n/g') + }' | sort | paste -s -d ':' | sed -e "s/\\\\n/\\n/g; s/'/\\\\'/g") echo "eval -client ${kak_client} echo completed - set 'buffer=${kak_buffile}' clang_completions \"${header}:${compl}\"" | kak -p ${kak_session} + set 'buffer=${kak_buffile}' clang_completions '${header}:${compl}'" | kak -p ${kak_session} else clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} - < ${dir}/buf 2> ${dir}/stderr fi