Search code examples
emacselispetags

Default regular expression for etags


I'd like to create additional regular expressions for use with etags, but I'd like them to be based upon what's already there (in particular, I'd like to add [ \t]* to the current set of regular expressions that etags uses). What are the default set of regular expressions that etags uses for .lisp files?


Solution

  • etags doesn't generally use regular expressions to implement the languages that are built-in. Instead, it has custom parser code for each built-in language.

    That said, it seems for Lisp to look for just a few forms, that could be handled by regular expressions:

    • It looks for "(" in the first column
    • It skips defvar
    • It ignores a "cl-" or "CL-" appearing after the "("
    • Then, "def" and "DEF" match
    • It also checks for "(package::def" as a lead-in

    I found this by reading lib-src/etags.c in the Emacs source tree. Search for "Lisp_functions".