Skip to content

Instantly share code, notes, and snippets.

Last active Jan 14, 2020
What would you like to do?
jump-to-definition in emacs via clj-kondo-powered TAGS file

jump-to-definition in emacs via clj-kondo-powered TAGS file


What is below is old information, the repository is more up-to-date.

Set up

  1. Configure indexer by editing ~/.clojure/deps.edn appropriately:
    :extra-deps {sogaiu/alc.index-defs {:git/url ""
                                        :sha "13d2a9f6d32ee7e92171ff9a51e1219826d1a8f7"}}
    :main-opts ["-m" "alc.index-defs.etags"]
  1. Index a Clojure code base:
$ cd ~/src/mycode
$ clj -A:alcid
  1. Wait a bit for indexing to complete -- note that the first time the indexer is run via clj (or when its commit hash is updated in deps.edn) dependencies may be downloaded so the time-to-wait before the TAGS file is created will likely be longer than otherwise :)

Try it out

  1. Launch emacs and open a Clojure file from the project

  2. Put point / cursor on an identifier you want to look up

  3. M-. -OR- M-x xref-find-definitions

  4. Likely you'll be asked to specify a location for the TAGS file -- there should be one in the project root now, so specify it.

  5. On the happy path, the definition should be in front of you, or there should be a buffer with a list of possible definitions to choose from.


  • Created files and directories are: TAGS and .alc-id (in project directory). The .alc-id directory should contain uncompressed jar files (without class files) that were among the project's dependencies.

  • To re-index, delete TAGS and .alc-id -OR- clj -A:alcid '{:overwrite true}'

  • Check out the top of Looking Up Identifiers for other related commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment