2018-03-22 06:54:18 -04:00
|
|
|
;;; lang/clojure/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-05-02 17:57:31 -04:00
|
|
|
;;;###autoload
|
|
|
|
(defun +clojure-cider-lookup-definition (identifier)
|
|
|
|
"A lookup handler for `cider-mode'.
|
|
|
|
|
|
|
|
This is necessary to fix `cider-find-dwim's inability to capture the full symbol
|
|
|
|
at point."
|
|
|
|
(cider-find-dwim identifier))
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Commands
|
|
|
|
|
2018-03-22 06:54:18 -04:00
|
|
|
;;;###autoload
|
2019-10-08 17:38:31 -04:00
|
|
|
(defun +clojure/open-repl (&optional arg type)
|
|
|
|
"Open a Cider REPL for clojure and return the buffer."
|
2018-10-16 02:14:53 -04:00
|
|
|
(interactive "P")
|
2019-10-08 17:38:31 -04:00
|
|
|
;; TODO Better error handling
|
2019-10-15 17:35:22 +02:00
|
|
|
;; type is `clj' for clojure and `cljs' for clojurescript
|
|
|
|
;; ... with no type specified, assume `clj'.
|
2019-10-08 17:38:31 -04:00
|
|
|
(let ((type (or type 'clj)))
|
|
|
|
(if-let (buffer (cider-current-repl type))
|
|
|
|
(pop-to-buffer buffer)
|
2019-10-15 17:35:22 +02:00
|
|
|
(let ((process (cond ((eq type 'clj) (cider-jack-in-clj arg))
|
|
|
|
((eq type 'cljs) (cider-jack-in-cljs arg)))))
|
2019-10-08 17:38:31 -04:00
|
|
|
(message "Starting CIDER server for the first time...")
|
|
|
|
(while (and (process-live-p process)
|
|
|
|
(not (cider-current-repl type)))
|
|
|
|
(sit-for 1))
|
|
|
|
(message "Starting CIDER server for the first time...done")
|
|
|
|
(pop-to-buffer (cider-current-repl type))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +clojure/open-cljs-repl (&optional arg)
|
|
|
|
"Open a Cider REPL for clojurescript and return the buffer."
|
|
|
|
(interactive "P")
|
|
|
|
(+clojure/open-repl arg 'cljs))
|
2018-10-16 02:09:24 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +clojure/cider-switch-to-repl-buffer-and-switch-ns ()
|
|
|
|
"TODO"
|
|
|
|
(interactive)
|
|
|
|
(cider-switch-to-repl-buffer t))
|