I downloaded emacs source code from http://savannah.gnu.org/projects/emacs/, and the relevant tags from http://git.savannah.gnu.org/cgit/emacs.git/refs/tags . I ran ctags via ctags -e -R . over both directories, then added the tag to my tags-table-list.

My tags table list value:("/home/eli/.emacs.d/library/TAGS")

Xref-find-definitions is still unable to find any definitions for emacs source functions or variables.

  • 1
    Try executing M-x visit-tags-table and chose a path to the TAGS file, does it change anything?
    – Hi-Angel
    Commented Jul 26, 2023 at 18:05
  • To add to the previous response, tags-table-list is supposed to be a list of file names (absolute ones), not directories. But anyway, try M-x visit-tags-table first. I hope you already generated one, or know how to do that.
    – Dmitry
    Commented Jul 26, 2023 at 22:34
  • @Hi-Angel No it doesn't. I've updated the question also
    – Eli Rusk
    Commented Jul 28, 2023 at 22:41
  • @Dmitry tags-table-list documentation states "An element that is a directory means the file "TAGS" in that directory."
    – Eli Rusk
    Commented Jul 28, 2023 at 22:44
  • Well, okay, so, I just tried putting (python-mode) to my *scratch* buffer, and executing M-x xref-find-definitions over it. It sends me to its declaration in /usr/share/… even though I have not loaded any TAGS files. With that said, it would be great if you provided a step-by-step minimal reproducible example of what you're doing, so we wouldn't have to guess. As a side note, you don't have to modify any variables for tags-based navigation to work, mere M-x visit-tags-table should be enough.
    – Hi-Angel
    Commented Jul 28, 2023 at 23:37

1 Answer 1


If you open TAGS file you may find out that all paths it has are relative. And xref-find-definitions also works under the same assumption, i.e. that to know whether to check a TAGS file it first goes to check if current directory is a child of the one where the TAGS file is located.

In simpler terms: xref-find-definitions checks what project you are trying to navigate, to figure out what TAGS file to use for navigation.

So the bottom line is: for xref-find-definitions to work with tags-based navigation you need to make sure the following points hold:

  1. TAGS file is located at the root of the repository you are trying to navigate
  2. In Emacs you have focused a buffer referring to some file inside the repository you are trying to navigate

So, since you're trying to navigate Emacs project, test this: α) execute M-x visit-tags-table and chose the TAGS file (located at the root of the project!) β) open a random file in the project, e.g. Makefile γ) put a caret before empty space (to suppress autocompletion for the next command) and execute M-x xref-find-definitions and type in malloc_initialize_hook. It should send you to its location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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