It would be convenient if I could arrange for visit-tags-table to open the TAGS file automatically with the correct syntax table for the language of the files being indexed in it. That way regular expressions would work the same way in the TAGS file as in the files indexed.

Does anyone know how to do that?

  • Hmm, I guess I could add " -- eval: (set-syntax-table coq-mode-syntax-table) --" to the first line of each tags file. Feb 28, 2017 at 17:30

1 Answer 1


the list of tags is stored in tags-table-list, when you load a file, you know the full path of that file (C-h v buffer-file-name), so you can tweak tags-table-list by buffer-file-name and make it buffer local.

BTW, you need create individual TAGS for each language. For example, one TAGS for javascript, another TAGS for PHP. That's pretty easy if you follow the suggestion from Emacs manual (https://www.gnu.org/software/emacs/manual/html_node/emacs/Create-Tags-Table.html) by using Find and Ctags together because you can specify the file extension when scanning files.

You still need write a little bit Emacs Lisp code but https://github.com/redguardtoo/find-and-ctags help you write less code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.