I found a funny problem with tags (well, not that funny since it slows
down my productivity).
I work with Python and the tags worked well until I worked with a file
named "tags.py". Now I keep having that error:
E431: Format error in tags file "itws--herve/tags.py"
Before byte 24
When I rename it to "tag.py", the problem disappears. That's where it's
funny.
I first suspected the tags file itself, but it seems to be correctly
generated: http://bpaste.net/show/7305/
Then I tried to trace down the tag code in vim and tried to hack
"src/tag.c". I expected to find some hard-coded "tags" but the best I
could achieve is not preventing from reaching the definition after error
431 occurred:
--- a/src/tag.c Sun May 16 13:56:06 2010 +0200
+++ b/src/tag.c Tue Jun 22 12:00:39 2010 +0200
@@ -2391,7 +2391,7 @@
if (!use_cscope)
#endif
EMSGN(_("Before byte %ld"), (long)ftell(fp));
- stop_searching = TRUE;
+ stop_searching = FALSE;
line_error = FALSE;
}
I'm using gvim 7.2 on Archlinux x86_64. I tried to remove every patch
that Archlinux applies but the problem remains.
Please provide any help to remove the fun from my Python sessions or
even a patch.
Thanks,
Herv�
You do not say what you do that results in the error. No doubt
if I were to fiddle around I may find it, but if possible
please spell out a minimal sequence of steps to reproduce the
problem. Do you know what the "itws--herve" stuff is? I would
have assumed a directory but the double dash is unusual.
John
(I hacked a little this post because I didn't find how to receive
answers and reply without creating a Google account, and I don't want to
create one.)
I just clicked on the tag icon (using gvim) to follow the name under the
cursor. Whatever that name is in "tags.py" or completely unrelated, vim
complains about the tags file.
"itws--herve" is indeed a directory where that faulty "tags.py" file is
located.
I tried to reproduce it with a couple of file including one named
"tags.py" but it didn't raise.
Herv�
You can email me directly if you want to sort this out, or just
reply to the list since others may be interested. You do NOT
need a Google account to subscribe to any of the Vim mailing
lists. You just follow the instructions found at the site shown
in the footer of each message. After subscribing, your first
post to the list is moderated (possible several hours delay).
After that, you just send and receive as on any list.
> I just clicked on the tag icon (using gvim) to follow the
> name under the cursor. Whatever that name is in "tags.py" or
> completely unrelated, vim complains about the tags file.
>
> "itws--herve" is indeed a directory where that faulty
> "tags.py" file is located.
>
> I tried to reproduce it with a couple of file including one
> named "tags.py" but it didn't raise.
If you find a situation where the error occurs on a regular
basis, please report the information, including the version of
Vim (shown by entering :version).
John
- 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"
Before byte 24
Press ENTER or type command to continue
That working directory can be downloaded at http://dl.free.fr/vxsVshgty
(2.5 MB) along with the tags file.
The tags file is named "tags", which I guess is the default.
The version is:
VIM - Vi IMproved 7.2 (2008 Aug 9, c Jun 23 2010 12:24:41)
Included patches: 1-436
Herv�
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
:echo tagfiles()
['tags']
After opening *any* file in itws:
:echo tagfiles()
['itws/tags.py', 'tags']
I didn't know about those variables. Reading from the help, it's an
interesting feature I'll use later. Until then, I've forced it to an
empty "". It's a good workaround until you sort out the usage of that
variable in searching tags.
Thanks to both of you!
Herv�