Vim Tips Wiki
(comment)
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ScriptComments|1343|AutoTag: update entries in tags file automatically when saving}}
+
{{ScriptComments|AutoTag: update entries in tags file automatically when saving}}
   
 
==Comments==
 
==Comments==
Line 88 should be:
+
In rev, 1.9, line 88 should be:
:<tt>if size is None:</tt>
+
:<code>if size is None:</code>
 
<small>--Preceding [[Vim Tips Wiki:Quick reference|unsigned]] comment added by [[User:75.36.191.118|75.36.191.118]] 00:04, February 23, 2010</small>
 
<small>--Preceding [[Vim Tips Wiki:Quick reference|unsigned]] comment added by [[User:75.36.191.118|75.36.191.118]] 00:04, February 23, 2010</small>
 
----
 
----
Line 13: Line 13:
 
return None
 
return None
 
</pre>
 
</pre>
If <tt>getattr()</tt> fails it returns <tt>None</tt> which is detected by "<tt>if not size</tt>". <s>Looks good.</s> [[User:JohnBeckett|JohnBeckett]] 01:14, February 23, 2010 (UTC)
+
If <code>getattr()</code> fails it returns <code>None</code> which is detected by "<code>if not size</code>". <s>Looks good.</s> [[User:JohnBeckett|JohnBeckett]] 01:14, February 23, 2010 (UTC)
:I just noticed the edit summary for the above comment and I now see what is meant: If the tags file happens to be empty, <tt>getattr()</tt> will return zero which the original code would regard as an error. [[User:JohnBeckett|JohnBeckett]] 02:30, February 23, 2010 (UTC)
+
:I just noticed the edit summary for the above comment and I now see what is meant: If the tags file happens to be empty, <code>getattr()</code> will return zero which the original code would regard as an error. [[User:JohnBeckett|JohnBeckett]] 02:30, February 23, 2010 (UTC)
  +
----
  +
The above fix is incorporated in rev 1.10.
  +
----
  +
how do i set custom ctags command
  +
----
  +
  +
In git-version from June 09, 2012 (commit 3acb0126a31927a2d90e7b904624545f5db51388) there is a bug with relativeSource path on line 181. Error on loading script.
  +
Here is fix:
  +
<pre>
  +
181c181,182
  +
< relativeSource = os.path.splitdrive(source)[1]source[len(tagsDir):]
  +
---
  +
> source = os.path.splitdrive(source)[1]
  +
> relativeSource = source[len(tagsDir):]
  +
</pre>

Latest revision as of 08:30, 21 July 2012

Use this page to discuss script 1343 AutoTag: update entries in tags file automatically when saving

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Comments[]

In rev, 1.9, line 88 should be:

if size is None:

--Preceding unsigned comment added by 75.36.191.118 00:04, February 23, 2010


I have not used the script but had a quick look. The Python code is:

    size = getattr(st, 'st_size', None)
    if not size:                             # (line 88)
	self.__diag("Could not stat tags file %s" % tagsFile)
	return None

If getattr() fails it returns None which is detected by "if not size". Looks good. JohnBeckett 01:14, February 23, 2010 (UTC)

I just noticed the edit summary for the above comment and I now see what is meant: If the tags file happens to be empty, getattr() will return zero which the original code would regard as an error. JohnBeckett 02:30, February 23, 2010 (UTC)

The above fix is incorporated in rev 1.10.


how do i set custom ctags command


In git-version from June 09, 2012 (commit 3acb0126a31927a2d90e7b904624545f5db51388) there is a bug with relativeSource path on line 181. Error on loading script. Here is fix:

181c181,182
<          relativeSource = os.path.splitdrive(source)[1]source[len(tagsDir):]
---
>          source = os.path.splitdrive(source)[1]
>          relativeSource = source[len(tagsDir):]