Monday, June 28, 2010

Re: funny error with ctags and vim

John Beckett wrote:

> Hervé Cauwelier wrote:
>> Here are the steps to reproduce the problem:
>> - cd into the directory that contains itws, etc.
>> - open gvim in that directory
>> - open about any file, say itws/addresses.py
>> - click on "Unicode" on line 21
>> - click on the "Jump to tag under the cursor" icon
>> - I get the following error:
>>
>> E431: Format error in tags file "itws/tags.py"
>
> Here is a simpler problem (I tried this with Vim 7.3):
> - directory project contains file tags
> - directory project/subdir contains files one.py, tags.py
>
> In directory project:
> - gvim subdir/one.py
> - put cursor on a keyword and press Ctrl-]
>
> Result: Vim gives error:
> E431: Format error in tags file "subdir\tags.py"
>
> Entering command ':set tags?' shows the default:
>  tags=./tags,tags
>
> The ./tags setting causes Vim to look in the directory of the
> current file (project/subdir) for a file called tags.
>
> However, Vim uses file tags.py because tags is not present!
>
> If Vim failed to find a ./tags file, it would use the second
> setting (tags) which would use project/tags (the current
> directory) and that would work.
>
> A workaround for Hervé would be to fiddle with the 'tags'
> setting. If nothing better comes to mind, enter the full path of
> the tags file:
>
> :set tags=/full/path/tags
>
> It seems weird that Vim would use file tags.py as a tags file.
> An extremely quick experiment suggest this problem does not
> occur if tags.py is renamed as tags.c so it seems to be
> something peculiar about tags.py?
>
> John

Using the attached file from Hervé,
I can also reproduce the E431:

E431: Format error in tags file "tags.py"
Before byte 24

I have:

:set tags?
tags=tags

But notice this:

:echo tagfiles()
['tags.py']

The problem happens because trying to find the tag
file uses vim_findfile(...) which uses the 'suffixesadd'
option. I have:

:set suffixesadd?
suffixesadd=.py

File "tags" does not exist, but file "tags.py" exists.
So that's why Vim picks the existing "tags.py" as tag file
even though it's clearly not a tag file (hence E431).

I don't think that finding the tag file is meant to use
'suffixesadd', is it?

-- Dominique

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: