Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


etags-update.el is a Emacs global minor mode that updates your TAGS when saving a file.


Put in your shell's PATH, making sure it is executable. For instance:

 # mv ~/bin
 # chmod 755 ~/bin/

To install the minor-mode, put the etags-update.el file in your load-path:

 # mv etags-update.el ~/elisp

And require it from your .emacs file:

 (require 'etags-update)


First, load your project's TAGS file:

 M-x visit-tags-table <your-tags-file>

Then toggle the minor-mode on with:

 M-x etags-update-mode

The same command toggles the minor-mode off.

The minor-mode is global, so it will be enabled in all your buffers. The string "etu" appears in the mode-line when etags-update is enabled.

When you save a file that is already listed in your TAGS file, the TAGS file will automatically be updated.

When you save a file that is not listed in your TAGS file, etags-update can add the file to your TAGS. The etu/append-file-action variable controls what happens. The default value, 'prompt, asks if you want to add the file. Etags-update remembers your choice for a file.

Customizable Variables


What action should be taken when a file not already in TAGS is saved?

If 'nil, do not add the file to TAGS.

If 'add, add the file.

If 'prompt, ask if this file should be added (default).

If set to a function, the function should return one of 'add, 'prompt, or 'nil.

For example, I use the following code to add files to TAGS when they are "in my project" according to mk-project.el and prompt otherwise:

(defun mk-etags-update-append-file-p (file)
    ((and mk-proj-name
          (string= mk-proj-basedir (substring file 0 (length mk-proj-basedir)))) ; eg, file *in* project
    (t 'prompt)))

(setq etu/append-file-prompt 'mk-etags-update-append-file-p)


If non-nil, will only offer to add a buffer to TAGS if the buffer has font-lock-defaults set. This is a weak indicator that the buffer represents code, not plain text. Defaults to t.


  1. etags-update can only update a TAGS file when one has been set using visit-tags-table. If the tags-file-name variable is nil, etags-update will not update TAGS. No warning is printed.

  2. etags-update only considers one TAGS file. It does not support multiple files in tags-table-list.

  3. When a file is newly added to the TAGS file, it is inserted with its absolute file name, not a file name relative to the TAGS file. Therefore, you should completely rebuild your TAGS file if you move your project to another directory.


etags-update.el is an Emacs global minor mode to update TAGS when a file is saved






No packages published