Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Emacs reload the TAGS file automatically?

Tags:

emacs

When the TAGS file is re-generated, and I try to visit tag in Emacs (M-.), Emacs asks me if I really want to re-read that file:

Tags file /path/to/TAGS has changed, read new contents? (yes or no)

And I have to enter yes every time. Not very convenient (M-. Enter y e s Enter are 7 keys to press against only 2 in Vim).

How can I configure Emacs to read the updated TAGS silently, without asking?

like image 946
sastanin Avatar asked Nov 04 '10 12:11

sastanin


People also ask

How do I refresh Emacs files?

By default, it points to the file you're currently on, so you can just type C-x C-v RET to reload your file.

What are Emacs tags?

The emacs editors can use the index file(s) produced by etags to search for a requested function name, defined name, or global variable, etc. Each of these search names are referred to as a tag. If the tag is found in the index, it will open the file containing the searched for tag in a new buffer.


1 Answers

(setq tags-revert-without-query 1) 

Edit: before finding the above answer, I suggested adding this line:

(defalias 'yes-or-no-p 'y-or-n-p) 

to .emacs file, because every time you're asked if you want to reread that file, you'll just have to hit 'y' if you prefer not to use tags-revert-without-query. In that case, M-. y is just one keystroke more than Vim.

I'll leave that information here in case somebody finds it useful.

like image 155
darioo Avatar answered Sep 21 '22 13:09

darioo