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 ?
' ( '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.
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.
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.
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)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With