clang.kak: use trap to remove the temporary directory, fix escaping problems
This commit is contained in:
parent
fd3365deb1
commit
15bb048428
|
@ -26,6 +26,8 @@ def -shell-params clang-parse %{
|
||||||
# position and a buffer timestamp, only valid completions should be
|
# position and a buffer timestamp, only valid completions should be
|
||||||
# displayed.
|
# displayed.
|
||||||
(
|
(
|
||||||
|
trap "rm -r ${dir}" EXIT
|
||||||
|
|
||||||
case ${kak_opt_filetype} in
|
case ${kak_opt_filetype} in
|
||||||
cpp) ft=c++ ;;
|
cpp) ft=c++ ;;
|
||||||
obj-c) ft=objective-c ;;
|
obj-c) ft=objective-c ;;
|
||||||
|
@ -71,14 +73,12 @@ def -shell-params clang-parse %{
|
||||||
" | paste -s -d ':')
|
" | paste -s -d ':')
|
||||||
|
|
||||||
errors=$(cat ${dir}/stderr | sed -rne "
|
errors=$(cat ${dir}/stderr | sed -rne "
|
||||||
/^<stdin>:[0-9]+:([0-9]+:)? (error|warning)/ { s/^<stdin>:([0-9]+):([0-9]+:)? (.*)/\1,\3/; p }")
|
/^<stdin>:[0-9]+:([0-9]+:)? (error|warning)/ { s/^<stdin>:([0-9]+):([0-9]+:)? (.*)/\1,\3/; s/'/\\\\'/g; p }")
|
||||||
|
|
||||||
sed -e "s|<stdin>|${kak_bufname}|g" < ${dir}/stderr > ${dir}/fifo
|
sed -e "s|<stdin>|${kak_bufname}|g" < ${dir}/stderr > ${dir}/fifo
|
||||||
|
|
||||||
echo "set 'buffer=${kak_buffile}' clang_flags %{${flags}}
|
echo "set 'buffer=${kak_buffile}' clang_flags %{${flags}}
|
||||||
set 'buffer=${kak_buffile}' clang_errors %{${errors}}" | kak -p ${kak_session}
|
set 'buffer=${kak_buffile}' clang_errors '${errors}'" | kak -p ${kak_session}
|
||||||
|
|
||||||
rm -r ${dir}
|
|
||||||
) > /dev/null 2>&1 < /dev/null &
|
) > /dev/null 2>&1 < /dev/null &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user