|
3 | 3 | " Last Change: June 22, 2013
|
4 | 4 | " URL: http://peterodding.com/code/vim/easytags/
|
5 | 5 |
|
6 |
| -let g:xolox#easytags#version = '3.3.11' |
| 6 | +let g:xolox#easytags#version = '3.3.12' |
7 | 7 |
|
8 | 8 | " Plug-in initialization. {{{1
|
9 | 9 |
|
@@ -54,25 +54,36 @@ function! xolox#easytags#check_ctags_compatible(name, min_version) " {{{2
|
54 | 54 | " This function makes sure it is because the easytags plug-in requires the
|
55 | 55 | " --list-languages option (and more).
|
56 | 56 | call xolox#misc#msg#debug("easytags.vim %s: Checking if Exuberant Ctags is installed as '%s'.", g:xolox#easytags#version, a:name)
|
57 |
| - if executable(a:name) |
58 |
| - let command = a:name . ' --version' |
59 |
| - let result = xolox#misc#os#exec({'command': command, 'check': 0}) |
60 |
| - if result['exit_code'] == 0 |
61 |
| - let pattern = 'Exuberant Ctags \zs\(\d\+\(\.\d\+\)*\|Development\)' |
62 |
| - let g:easytags_ctags_version = matchstr(get(result['stdout'], 0, ''), pattern) |
63 |
| - call xolox#misc#msg#debug("easytags.vim %s: Executable '%s' reported version '%s'.", g:xolox#easytags#version, a:name, g:easytags_ctags_version) |
64 |
| - if g:easytags_ctags_version == 'Development' |
65 |
| - call xolox#misc#msg#debug("easytags.vim %s: Assuming development build is compatible ..", g:xolox#easytags#version, a:name) |
66 |
| - return 1 |
67 |
| - elseif xolox#misc#version#at_least(a:min_version, g:easytags_ctags_version) |
68 |
| - call xolox#misc#msg#debug("easytags.vim %s: Version is compatible! :-)", g:xolox#easytags#version) |
69 |
| - return 1 |
70 |
| - else |
71 |
| - call xolox#misc#msg#debug("easytags.vim %s: Version is not compatible! :-(", g:xolox#easytags#version) |
72 |
| - return 0 |
73 |
| - endif |
| 57 | + " Make sure the given program is executable. |
| 58 | + if !executable(a:name) |
| 59 | + call xolox#misc#msg#debug("easytags.vim %s: Program '%s' is not executable!", g:xolox#easytags#version, a:name) |
| 60 | + return 0 |
| 61 | + endif |
| 62 | + " Make sure the command exits without reporting an error. |
| 63 | + let command = a:name . ' --version' |
| 64 | + let result = xolox#misc#os#exec({'command': command, 'check': 0}) |
| 65 | + if result['exit_code'] != 0 |
| 66 | + call xolox#misc#msg#debug("easytags.vim %s: Command '%s' returned nonzero exit code %i!", g:xolox#easytags#version, a:name, result['exit_code']) |
| 67 | + else |
| 68 | + " Extract the version number from the output. |
| 69 | + let pattern = 'Exuberant Ctags \zs\(\d\+\(\.\d\+\)*\|Development\)' |
| 70 | + let g:easytags_ctags_version = matchstr(get(result['stdout'], 0, ''), pattern) |
| 71 | + " Deal with development builds. |
| 72 | + if g:easytags_ctags_version == 'Development' |
| 73 | + call xolox#misc#msg#debug("easytags.vim %s: Assuming development build is compatible ..", g:xolox#easytags#version, a:name) |
| 74 | + return 1 |
| 75 | + endif |
| 76 | + " Make sure the version is compatible. |
| 77 | + if xolox#misc#version#at_least(a:min_version, g:easytags_ctags_version) |
| 78 | + call xolox#misc#msg#debug("easytags.vim %s: Version is compatible! :-)", g:xolox#easytags#version) |
| 79 | + return 1 |
| 80 | + else |
| 81 | + call xolox#misc#msg#debug("easytags.vim %s: Version is not compatible! :-(", g:xolox#easytags#version) |
74 | 82 | endif
|
75 | 83 | endif
|
| 84 | + call xolox#misc#msg#debug("easytags.vim %s: Standard output of command: %s", g:xolox#easytags#version, string(result['stdout'])) |
| 85 | + call xolox#misc#msg#debug("easytags.vim %s: Standard error of command: %s", g:xolox#easytags#version, string(result['stderr'])) |
| 86 | + return 0 |
76 | 87 | endfunction
|
77 | 88 |
|
78 | 89 | function! xolox#easytags#register(global) " {{{2
|
|
0 commit comments