Emacs can do this "out of the box". See Tags in the Emacs manual. (Press C-h r m tags RET
to read this section in Emacs.)
Here's what I did to make sure it works.
- Got Emacs sources from https://github.com/emacs-mirror/emacs
- Ran
find . -iname "*.c" -or -iname "*.h" | xargs etags
to create a TAGS table. - Added this
TAGS
table usingM-x visit-tags-table
.
Now I can put my cursor on optional_new_start
in window.c
, press M-. RET
and end up on the appropriate line in window.h
.
You can then press M-*
to go back to the point you started from.
PS: It does not matter if variable and function names have underscores in them.