# HG changeset patch # User Ludovic Chabant # Date 1572072732 25200 # Node ID e61d20280c6c49010f8bd399defba5ffc7a30672 # Parent d264db0126c26ca0e75eeb45efa83eca7b839a03 Fix some more spaces-in-paths issues. When using the tags cache directory, the project root is passed to ctags. Escaping this path didn't work correctly when it has spaces: - We remove the quotes around it on *nix because `job_start()` doesn't like those, but then we need to escape the spaces with backslashes otherwise the script doesn't understand those parameters. - Once the escaping is gone in the script, we need to quote them but it looks like sh doesn't like double quotes in the middle of an env var or something, so we need to put the project root in a separate env var. diff -r d264db0126c2 -r e61d20280c6c autoload/gutentags.vim --- a/autoload/gutentags.vim Fri Oct 25 23:48:08 2019 -0700 +++ b/autoload/gutentags.vim Fri Oct 25 23:52:12 2019 -0700 @@ -114,7 +114,9 @@ let l:arglen = strlen(cmdarg) if (cmdarg[0] == '"' && cmdarg[l:arglen - 1] == '"') || \(cmdarg[0] == "'" && cmdarg[l:arglen - 1] == "'") - call add(l:outcmd, cmdarg[1:-2]) + " This was quoted, so there are probably things to escape. + let l:escapedarg = cmdarg[1:-2] " substitute(cmdarg[1:-2], '\ ', '\\ ', 'g') + call add(l:outcmd, l:escapedarg) else call add(l:outcmd, cmdarg) endif diff -r d264db0126c2 -r e61d20280c6c plat/unix/update_tags.sh --- a/plat/unix/update_tags.sh Fri Oct 25 23:48:08 2019 -0700 +++ b/plat/unix/update_tags.sh Fri Oct 25 23:52:12 2019 -0700 @@ -5,6 +5,7 @@ PROG_NAME=$0 CTAGS_EXE=ctags CTAGS_ARGS= +CTAGS_ARG_QUOTED_LAST= TAGS_FILE=tags PROJECT_ROOT= LOG_FILE= @@ -120,14 +121,15 @@ echo "${PROJECT_ROOT%/}/${l}" done > "${TAGS_FILE}.files" fi - CTAGS_ARGS="${CTAGS_ARGS} -L "${TAGS_FILE}.files"" + CTAGS_ARGS="${CTAGS_ARGS} -L" + CTAGS_ARG_QUOTED_LAST="${TAGS_FILE}.files" else - CTAGS_ARGS="${CTAGS_ARGS} "${PROJECT_ROOT}"" + CTAGS_ARG_QUOTED_LAST="${PROJECT_ROOT}" fi echo "Running ctags on whole project" - echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS" - $CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS + echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS \"$CTAGS_ARG_QUOTED_LAST\"" + $CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS "$CTAGS_ARG_QUOTED_LAST" else echo "Running ctags on \"$UPDATED_SOURCE\"" echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS --append \"$UPDATED_SOURCE\""