Darren,

 

After investigating more in details, I believe I have found a bug in ctags.

 

The root cause of the problem I’m seeing is that the routine absoluteFilename always makes the drive letter uppercase (Windows paths only).

On the other hand, the routine absoluteDirname does not do the same.

 

This in turn causes problems in the routine setSourceFileParameters, more specifically on the line:

relativeFilename (vStringValue (fileName), TagFile.directory)

 

In effect, relativeFilename compares the two strings, which sometimes differ from the start (drive letter with a different case).

The net effect is that relativeFilename identifies no common path between the two strings, and therefore returns absolute paths.

 

There are several ways to solve the problem (which may be more widespread than just the above example). I could just suggest my own quick and dirty fix, but I believe you are in the best position to make a nice and clean one.

 

Hope that helps,

David.

 


From: Darren Hiebert [mailto:Darren@DarrenHiebert.com]
Sent: 17 July 2012 14:13
To: David Chappaz
Cc: Ctags Users
Subject: Re: [Ctags] Ctags generates absolute instead of relative paths

 

David,

 

I apologize for not replying sooner, but my “offline life” has become troublesome and dominating. I won’t take up that here.

 

To your problem: if you simply run the command “ctags -e -R”, only relative file paths will go into the TAGS file. You can bring up the TAGS file in a suitable editor to verify this (the format of a TAGS file is many entries separated by a form-feed character, followed by the file path, followed by subentries for each tags for that file). I presume that you are using a file list with ctags because you want tags only for a limited list of files?

 

However, the output of “find” may be sending absolute file names into ctags, which ctags will respect. Try running just the “find” command without piping the output to ctags and see what comes out.

 

Now, if the TAGS file contains relative files, and you are not getting what you want out of emacs, the problem is with emacs.

 

Darren

 

On Jul 11, 2012, at 4:35 AM, David Chappaz wrote: