I use xref to find tags in emacs 25.

My problem is with C defines, when there are multiple definitions. The *xref* buffer shows suggestions, but does not show enough text (it stops right after the identifier).

For example, when looking up PRINTF, one of the found definitions showed in the *xref* buffer looks like this:

#define PRINTF(

while the actual code at that location is:

#define PRINTF(FORMAT, args ...) printf_P(PSTR(FORMAT), ## args)

How do I make the xref buffer show the whole row in the file?

Edit: creating my TAGS with:

;; Shell command: find . -type f \( -name '*.cpp' -o -name '*.[ch]pp' \) | etags -
(defun create-tags (dir-name)
  "Create tags file."
  (interactive "DDirectory: ")
   (format "cd %s && find . -type f \\( -name \'*.[ch]\' -o -name \'*.[ch]pp\' \\) | etags -" dir-name))
  • 1
    Seems like more an issue with the program used to generate the TAGS file. Are you using etags, ctags, ggtags, etc ?
    – InHarmsWay
    May 30, 2018 at 11:30
  • @InHarmsWay Ha, that makes sense. I use etags, editing to add how.
    – Gauthier
    May 30, 2018 at 21:20
  • If you don't like etags's behavior, and you can't find a relevant flag to change it, please go ahead and file a bug report.
    – Dmitry
    May 31, 2018 at 12:34


Your Answer

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

Browse other questions tagged or ask your own question.