From 9762c28efd5e7ecffc35650dd6147149f2f573a7 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Sat, 26 Nov 2011 00:56:30 +0100 Subject: Bug fix for file type specific tags file support While adding some debugging statements to analyze a probably unrelated issue I found a serious bug in the support for file type specific tags files :-(. This commit fixes the bug and adds more debugging output (which would have made me aware of this problem much sooner). --- autoload/xolox/easytags.vim | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'autoload') diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 993a4c4..31704b0 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -1,9 +1,9 @@ " Vim script " Author: Peter Odding -" Last Change: November 21, 2011 +" Last Change: November 26, 2011 " URL: http://peterodding.com/code/vim/easytags/ -let g:xolox#easytags#version = '2.7.3' +let g:xolox#easytags#version = '2.7.4' " Public interface through (automatic) commands. {{{1 @@ -372,9 +372,17 @@ endfunction function! s:save_by_filetype(filter_tags, headers, entries, context) let filetypes = {} + let num_invalid = 0 for entry in a:entries - let ctags_ft = matchstr(entry[2], '\tlanguage:\zs\S\+') - if !empty(ctags_ft) + let ctags_ft = matchstr(entry[4], '^language:\zs\S\+$') + if empty(ctags_ft) + " TODO This triggers on entries where the pattern contains tabs. The interesting thing is that Vim reads these entries fine... Fix it in xolox#easytags#read_tagsfile()? + let num_invalid += 1 + if &vbs >= 1 + call xolox#misc#msg#debug("easytags.vim %s: Skipping tag without 'language:' field: %s", + \ g:xolox#easytags#version, string(entry)) + endif + else let vim_ft = xolox#easytags#to_vim_ft(ctags_ft) if !has_key(filetypes, vim_ft) let filetypes[vim_ft] = [] @@ -382,10 +390,17 @@ function! s:save_by_filetype(filter_tags, headers, entries, context) call add(filetypes[vim_ft], entry) endif endfor + if num_invalid > 0 + call xolox#misc#msg#warn("easytags.vim %s: Skipped %i lines without 'language:' tag!", g:xolox#easytags#version, num_invalid) + endif let directory = xolox#misc#path#absolute(g:easytags_by_filetype) for vim_ft in keys(filetypes) let tagsfile = xolox#misc#path#merge(directory, vim_ft) - if !filereadable(tagsfile) + let existing = filereadable(tagsfile) + call xolox#misc#msg#debug("easytags.vim %s: Writing %s tags to %s tags file %s.", + \ g:xolox#easytags#version, len(filetypes[vim_ft]), + \ existing ? "existing" : "new", tagsfile) + if !existing call xolox#easytags#write_tagsfile(tagsfile, a:headers, filetypes[vim_ft]) else call s:filter_merge_tags(a:filter_tags, tagsfile, filetypes[vim_ft], a:context) -- cgit v1.2.3