From 79b193d2bec8d446a20a0ec7f4e78a27fad0b9a7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 28 Oct 2016 09:48:57 +0100 Subject: [PATCH] Fix ctags update-tag command that could fail depending on the locale --- rc/base/ctags.kak | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak index 18e125fc..b66f9256 100644 --- a/rc/base/ctags.kak +++ b/rc/base/ctags.kak @@ -89,11 +89,16 @@ def update-tags -docstring 'Update tags for the given file' %{ trap 'rmdir .tags.kaklock' EXIT 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 msg="tags updated for $kak_bufname" else msg="tags update failed for $kak_bufname" fi + + printf %s\\n "eval -client $kak_client echo -color Information '${msg}'" | kak -p ${kak_session} ) > /dev/null 2>&1 < /dev/null & } }