Closed yuhan0 closed 5 years ago
Something like this could be added to clojure-mode
, as you don't really need a running REPL for it. As there are tools like Projectile and project.el that allow you to quickly jump to a file in project, I'm not sure that's something that we really need.
You could add this to your own config. :)
(defun me/find-dominating-file (f)
(when-let ((dir (locate-dominating-file "./" f)))
(expand-file-name f dir)))
(defun me/find-my-file ()
(interactive)
(let* ((files '("project.clj" "build.boot" "deps.edn" "Gemfile"))
(file-found (car (delq nil (mapcar #'me/find-dominating-file files)))))
(find-file (or file-found
(user-error "No relevant file found here")))))
Thanks for the feedback - I assumed one needed a running REPL to determine which file to visit, eg. in the case of Clojurescript projects with multiple such files. The above snippet works well enough for my needs though, feel free to close this issue if it's not relevant to CIDER after all :)
It would be nice to have a command like
cider-find-config
which jumps directly to a buffer for the project-specific configuration file, whether it isdeps.edn
orproject.clj
orbuild.boot
.I'm not too familiar with Clojurescript but I believe the common setup is for there to be separate files for the
clj
andcljs
side of things – this command would visit the appropriate one depending on the current file.Is this information already contained somewhere in CIDER's environment? I could try to help implementing it with a pointer or two in the right direction :)