help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Choosing tags tables


From: Daniel Lopez
Subject: Choosing tags tables
Date: Thu, 20 Jul 2017 04:17:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi,

After more than a decade of Emacs use I thought I'd finally try out the tags features. I regularly code in different languages so I'm gonna need to call on different tags tables in different buffers. And I tend to use libraries in each of those languages so I'll want to have more than one tags table in each search, ie. that of the utility library/libraries and that of the project I'm working on.

So I set it up so that for example in my c++-mode-hook it sets tags-table-list with the multiple tags files I want to use for C++; the first is the library I use in all my C++ projects and the second is the project-specific tags file (assuming all project sources are in the same directory as TAGS, for now). I'm setting it as buffer-local so that it only applies to tag searches that are started when that buffer is current:

 (setq-local tags-table-list
   (list "/home/daniel/docs/code/c/reusable/checkout/dan/TAGS"
         (concat default-directory "TAGS")))

However when I then do a xref-find-definitions Emacs prompts me:
"Visit tags table (default TAGS):"
because (in visit-tags-table-buffer) it's not looking for the buffer-local value of tags-table-list, only the global which is nil. If I go along with it and enter something then Emacs sets tags-file-name to my entry which means now I only have one tags file and my tags-table-list gets ignored.

I alternatively tried this in my c++-mode-hook:

(visit-tags-table "/home/daniel/docs/code/c/reusable/checkout/dan/TAGS")
(visit-tags-table (concat default-directory "TAGS"))

but then whenever I open a file I get prompted about whether I want the second one to replace the first or be appended in consideration. I don't want to be prompted at all, I'd like to set most of this up in my init. I might want to call up such prompts to tweak things later but it's not likely.

Does anyone know of a better way to get this effect?

Regards,
Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]