I'm generating a tags file (in emacs format) using exuberant ctags, I pass this additional flag:
--regex-PHP=/do\_action\(\ '([a-zA-Z0-9\_]+)'/\1/a,actions/
Which successfully captures what I want, the issue is I want to use emacs lisp to return all tags marked as "a" in the form of a list - or I'll even settle for just matching a regular expression of do_action.
Unfortunately, it seems everything in etags.el is geared towards interactive usage, find-tag-in-order
was the only non-interactive way I could think to do it, but my code returns an error message regardless of whether or not anything is matching:
(find-tag-in-order
"test_string"
find-tag-regexp-search-function
find-tag-regexp-tag-order
find-tag-regexp-next-line-after-failure-p
"matching"
t)
While doing an interactive M-x find-tag test_string will bring me to the file and point in which it's defined.
The ideal usage would be something like:
(tags-of-type "a")
or (tags-matching "do_action")
. Though I understand the name of the tag is what's matched in the parenthesized group of my regular expression.
Any ideas?
Update:
Though this does not solve the issue of getting tags in the form of an emacs lisp list, I realize that with the --PHP-kinds
parameter it will be possible to maintain multiple tags files for each type.
In this method, the approach (while not working) would be something like this:
(let ((tags-table-list '("tag-file-1")))
(tags-search "specific-to-tag-file-1"))
What you want, I think, is (tags-completion-table)
. It returns an obarray of symbols that are entries in the current TAGS tables.
In any case, depending on just what it is that you are after, I think function tags-completion-table
and its cache variable of the same name are the place to start. Both are defined in library etags.el
.
(If you need a list of strings instead of an obarray of symbols, just use mapatoms
and symbol-name
.)