emacs + clojure + find definition of function
Problem Statement:
I am writing Clojure (and some ClojureScript) code with Lein + Emacs.
I want to be able to jump to the definition of an arbitrary function.
For example, suppose I do "Cx magic-key-stroke rect->area", then I want it to jump me to:
src/rect.clj, line 20, which has the content:
(defn rect->area [] ... )
Question:
How do I achieve the above in Emacs / Clojure?
Edit:
I sorta lied in my original question. I'm not using clj + cljs.
I'm using cljx (https://github.com/lynaghk/cljx) , which does cljx -> clj/cljs.
As a result, a "nrepl" solution does not work as well as something that reads the source code. (Ie I want it to jump me to the *.cljx file, not the *.clj file).
If you scroll to the bottom here you'll see this:
If instead you want to jump to the source of the function you can use M-., which is awesome. This works on your own functions as well as those which come from third-party libraries. Use M-, to pop the stack and return to where you were.
Does this help?
链接地址: http://www.djcxy.com/p/38586.html上一篇: 如何在函数定义之前忽略字符串