Fix ctags update-tag command that could fail depending on the locale

This commit is contained in:
Maxime Coste 2016-10-28 09:48:57 +01:00
parent be8b8a740d
commit 79b193d2be

View File

@ -89,11 +89,16 @@ def update-tags -docstring 'Update tags for the given file' %{
trap 'rmdir .tags.kaklock' EXIT trap 'rmdir .tags.kaklock' EXIT
if ctags -f .file_tags.kaktmp ${kak_opt_ctagsopts} $kak_bufname; then if ctags -f .file_tags.kaktmp ${kak_opt_ctagsopts} $kak_bufname; then
grep -Fv "$(printf '\t%s\t' "$kak_bufname")" tags | grep -v '^!' | sort --merge - .file_tags.kaktmp > .tags.kaktmp export LC_COLLATE=C LC_ALL=C # ensure ASCII sorting order
# merge the updated tags tags with the general tags (filtering out out of date tags from it) into the target file
grep -Fv "$(printf '\t%s\t' "$kak_bufname")" tags | grep -v '^!' | sort --merge - .file_tags.kaktmp >> .tags.kaktmp
rm .file_tags.kaktmp
mv .tags.kaktmp tags mv .tags.kaktmp tags
msg="tags updated for $kak_bufname" msg="tags updated for $kak_bufname"
else else
msg="tags update failed for $kak_bufname" msg="tags update failed for $kak_bufname"
fi fi
printf %s\\n "eval -client $kak_client echo -color Information '${msg}'" | kak -p ${kak_session}
) > /dev/null 2>&1 < /dev/null & } ) > /dev/null 2>&1 < /dev/null & }
} }