Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to auto-regenerate and load tags table in emacs rather than having to keep running visit-tags-table?

Tags:

emacs

etag

I am trying to find a way to auto-regenerate tags for my application and visit those tags in emacs to try to improve my workflow. Is it possible to get emacs to detect changes in TAG file and re-visit it ?

like image 422
aakarsh Avatar asked Mar 31 '10 04:03

aakarsh


People also ask

How do I use tags in Emacs?

' ( 'find-tag' ) – find a tag, that is, use the Tags file to look up a definition. If there are multiple tags in the project with the same name, use ` C-u M-. ' to go to the next match. 'M-x find-tag-other-window' – selects the buffer containing the tag's definition in another window, and move point there.

How do I use Ctags in Emacs?

To use ctags with emacs, you must supply the '-e' parameter to instruct ctags to generate an emacs tag file. The commands below are often sourced into a Makefile and then run with a CompileCommand. Ctags also has a recursive option, '-R' . This is the most common (and simple) usage.


2 Answers

There is a tags setting:

(setq tags-revert-without-query t)

Which will tell tags functionality to re-visit the TAGS file if it changes on disk. This check happens every time you invoke a tags function.

like image 69
Trey Jackson Avatar answered Sep 22 '22 12:09

Trey Jackson


Maybe not exactly what you're looking for, but I have a small function to regenerate and re-visit the tags table in the current working directory that I use all the time.

(defvar tags-cmd "etags -R 2>/dev/null")

(defun regen-tags ()
  "Regenerate the tags file for the current working directory"
  (interactive)
  (let ((tag-file (concat default-directory "TAGS")))
    (shell-command tags-cmd)
    (visit-tags-table tag-file)))
like image 41
Marc Avatar answered Sep 21 '22 12:09

Marc