0

A typical line in a TAGS file looks like this (note use of special characters ^? and ^A)

(defvar copyright-owner user-full-name^?copyright-owner^A213,7296

and a find-tag-regexp will search the entire line. But I want to restrict my searches to just the 2nd column, i.e. copyright-owner. In particular, for this example I want to avoid false positives for searches of user-full-name from finding this entry.

How can I restrict find-tag-regexp to just the matching part of the line and not the whole line?

Format defined in more detail here https://en.wikipedia.org/wiki/Ctags#Etags_2

  • You can try advising tag-re-match-p. – Dmitry Dec 15 '15 at 23:49
0

ouch, it looks like find-tag explicitly only searches the first column and never looks at the tag itself. That's nasty.

From etags-tags-completion-table

  ;; This monster regexp matches an etags tag line.
  ;;   \1 is the string to match;
  ;;   \2 is not interesting;
  ;;   \3 is the guessed tag name; XXX guess should be better eg DEFUN
  ;;   \4 is not interesting;
  ;;   \5 is the explicitly-specified tag name.
  ;;   \6 is the line to start searching at;
  ;;   \7 is the char to start searching at.

To bypass this issue entirely, I now use etags-select.

  • 1
    That's a wrong interpretation. \1 is just a big group, I don't know why it's called "string to match", but this function has been simplified a lot in the current development tree. – Dmitry Dec 15 '15 at 23:47
  • 1
    Anyway, this function just extracts the "completion" table, which only affects the suggestions for available tags, not the find-tag-regexp logic. – Dmitry Dec 15 '15 at 23:49

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.