4

I have a TAGS file, generated by Projectile, its size ~1Gb and when i accidentally switch current buffer to TAGS, Emacs freeze for long. Is there way to prevent TAGS buffer from opening?

1

I guess you mean when opening the TAGS file, not when showing the tags buffer in a window? My emacs (24.5) has variable large-file-warning-threshold set to 10000000, and if I say find-tag, or otherwise visit a large TAGS file (any large file), I get a message and have to confirm the open:

File TAGS is large (size), really open?

2

Emacs utilises TAGS files by visiting them and searching through their contents for the tag you're looking for. So no, you can't avoid visiting the TAGS file if you're utilising it. (If you're not, then just don't generate it; but I assume you want it.)

Consider using GNU Global instead, which queries its database with an external tool, and therefore does not require the database to be visited by Emacs. If it's compatible with your project, it will undoubtedly be faster and more convenient than dealing with a TAGS file of that size.

Failing that, you might be able to usefully reduce the size of your TAGS file if you don't actually need to index everything that is currently being indexed. You'll need to read the etags/ctags documentation to determine what you can do in this respect.

There are also several options for ctags itself -- GNU etags/ctags which comes with Emacs; Exuberant Ctags (which I've long used in preference to the GNU version); and these days there is https://ctags.io which sounds to me like it's the best maintained successor to Exuberant Ctags (although I've yet to try it myself). These may offer varying options for limiting what you index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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