Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am relatively new to emacs and using emacs version 21.3.1 and trying out the ctags for emacs (mainly to jump to definitions).

I am working with a big solution with lots of projects. Problem is that whenever I am trying to jump to tags under a cursor using command M-. , it tries to find a tags table from current directory of the source file.

My TAGS file is located at the root of my solution. So I have to point to it using M-x visit-tags-table [path to my tag file].

Is there a way to set this when I start up emacs so I do not have to point to it every time?

share|improve this question
Do you mean even after telling Emacs where the TAGS file is, it keeps asking for its location? – choroba Jan 16 '13 at 15:33
Once I specify it, it doesn't ask anymore. I just want this to be done on startup. – joonho Jan 16 '13 at 15:42
Nevermind, I was able to set it in my .emacs file by adding (setq tags-table-list '("[path to my tag file]")) – joonho Jan 16 '13 at 15:45
Are you using emacsclient? Do not open a new emacs for each file to be edited. – choroba Jan 16 '13 at 15:55
up vote 3 down vote accepted

It seems like the variable tags-file-name is the one you want to set.

One way would be to set it in your .emacs, something like:

(setq tags-file-name "path/to/file")

I wouldn't do it, as it will fix the tags table globally, and in case you'd like to use a different table (say for a different project) this won't work.

It seems that you could use the so called local variables and set this one per file. Do C-h v tags-file-name RET to see some more info.

share|improve this answer
Your method worked too. However I have decided not to set the tags on start-up for the exact reason you mentioned. Thanks. – joonho Jan 23 '13 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .