xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

Error when generating helptags with pathogen #7

Closed jmcantrell closed 13 years ago

jmcantrell commented 13 years ago

When updating the helptags via pathogen:

vim -c 'call pathogen#helptags()' -c 'q'

I get the following error:

Error detected while processing function <SNR>58_RegisterTagsFile:
line    3:
E117: Unknown function: xolox#misc#option#split_tags
E15: Invalid expression: xolox#misc#option#split_tags(&tags)
line    4:
E121: Undefined variable: tagfiles
E116: Invalid arguments for function copy(tagfiles), 'resolve(expand(v:val))')
E116: Invalid arguments for function map(copy(tagfiles), 'resolve(expand(v:val))')
E15: Invalid expression: map(copy(tagfiles), 'resolve(expand(v:val))')
line    6:
E121: Undefined variable: expanded
E116: Invalid arguments for function index(expanded, resolve(expand(g:easytags_file))) == -1
E15: Invalid expression: index(expanded, resolve(expand(g:easytags_file))) == -1
Press ENTER or type command to continue

This is on OS X 10.6.7 with MacVim

xolox commented 13 years ago

Hi Jeremy,

Did you install the easytags plug-in using a direct git checkout of the repository on GitHub (possibly using Pathogen)? Because the git repository contains a submodule with miscellaneous auto-load scripts and unfortunately git doesn't clone submodules by default... You can use a command such as the following to clone the repository including the submodule:

git clone --recursive https://github.com/xolox/vim-easytags.git

Hope this helps!

PS. Since I switched to using submodules I haven't updated the installation instructions, I'll do that ASAP.

jmcantrell commented 13 years ago

Ah. That was it. Thanks

blueyed commented 13 years ago

@xolox: might be a good idea to catch this error and display a more friendly error (referring to the "recursive" part). I've been running into this myself, and it will happen with others, too.

xolox commented 13 years ago

@blueyed: Adding checks everywhere a xolox#misc#* function is called doesn't sound very appealing :-) but I could add something like the following to the start of the plug-in to help users getting started:

try
  call xolox#misc#os#is_win()
catch /^Vim\%((\a\+)\)\=:E117/
  echoerr "It looks like the plug-in wasn't correctly installed, if you're using git you"
  echoerr "should probably use \"git clone --recursive ...\" to clone the repository"
  finish
endtry

Maybe I should add a more detailed explanation about this in INSTALL.md and have the error message refer to this file online. Of course that would require users to actually follow the link and read the installation instructions (not a lot of success with that so far :-)

blueyed commented 13 years ago

@xolox: Would it be possible to have a autoload-fallback which would get used if the submodule is not initialized (and could echo the error)?

xolox commented 13 years ago

@blueyed: It's impossible to define an autoload function outside of the script with the corresponding filename (the prefix of the function name and the script name have to match). However I don't see the practical difference between my suggestion and yours... Is it that you're worried the explicit check will slow things down unnecessarily? Because in that case I would worry more about the execution of ctags --version which takes an order of magnitude more time than checking whether an autoload function is callable.

xolox commented 13 years ago

I just committed 6ddd431b695e6a93227102cc097cf3f360071633 which might not be the most elegant way to detect the problem of the missing submodule but it's a start at least.