diff autoload/gutentags/ctags.vim @ 167:34c57ad6eb45

Always use the potentially custom name for the tags file. If the tags file got a custom name from `gutentags_init_user_func`, we need to use that in all situations. However, the tags file name we get in the `generate` function is a full path so we make it relative to the project root if possible when we don't use a cache directory for tags files.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 18 Feb 2017 21:57:52 -0800
parents cbc1ebe23ef1
children 95afd985a4c3 0e7ffc799cc5
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim	Sat Feb 18 21:45:39 2017 -0800
+++ b/autoload/gutentags/ctags.vim	Sat Feb 18 21:57:52 2017 -0800
@@ -82,14 +82,15 @@
     endif
 
     if empty(g:gutentags_cache_dir)
-        " If we don't use the cache directory, let's just use the tag filename
-        " as specified by the user, since it's relative to the project root,
-        " and we are already `chdir`'d into it.
-        " Note that if we don't do this and pass a full path, `ctags` gets
-        " confused if the paths have spaces -- but not if you're *in* the
-        " root directory.
+        " If we don't use the cache directory, we can pass relative paths
+        " around.
+        "
+        " Note that if we don't do this and pass a full path for the project
+        " root, some `ctags` implementations like Exhuberant Ctags can get
+        " confused if the paths have spaces -- but not if you're *in* the root 
+        " directory, for some reason...
         let l:actual_proj_dir = '.'
-        let l:actual_tags_file = g:gutentags_ctags_tagfile
+        let l:actual_tags_file = fnamemodify(a:tags_file, ':.')
     else
         " else: the tags file goes in a cache directory, so we need to specify
         " all the paths absolutely for `ctags` to do its job correctly.