On Tue, 27 Feb 2007, Hans Hagen wrote:
Aditya Mahajan wrote:
Hi
Here is my first attempt (see attachment). It works correctly in the little testing that I have done (on Windows). Just add \usemodule[ctags] somewhere in your environment file, and run context. I file called context.tags will be generated which contains the labels, filename, and line-number where the label occurs (line number can sometimes be off).
I modify a few core macros, so this can possibly break existing stuff (It should not, but then ...) i didn't look at the code yet, but maybe a hook is a safer way?
The redefinition is safe. I put the warning since the user must be aware that a module redefines a core macro. There are two redefinitions, one for knowing the name of the current file, and the other for writings the reference to the tags file. For knowing the name of the current file, I would say that the core should support it. From what I understand, \inputfilename (or \currentfile) should give the name of the current file, but they do not. So, I had to modify registerfileinfo so that it provides with the name of the current file. To write the reference into the tag file, I need to know the reference. That is why I had to modify writereference. One hook that I can think of is to provide an \everywritereference token. \def\writereference#1#2#3#4 {\def\currentreferece{#1} \the\everywritereference % Rest of the writereference code} Then, modules like ctags will be able to hook into everywritereference. Aditya