diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-10-05 16:29:18 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-10-05 16:29:18 +0100 |
commit | 81475f44b8c3b85b54f194d063ba6bb2f56c5117 (patch) | |
tree | c98468ec31ccce502b11850c7c6d59eb027684cb /.emacs.d | |
parent | 3f0c36c91e09cf557391791a9b90f3da568ff021 (diff) | |
download | dotfiles-81475f44b8c3b85b54f194d063ba6bb2f56c5117.tar.gz |
Add cider-jack-in-and-run-main
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/lisp/init-clojure.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-clojure.el b/.emacs.d/lisp/init-clojure.el index b76a237..6b2cf4e 100644 --- a/.emacs.d/lisp/init-clojure.el +++ b/.emacs.d/lisp/init-clojure.el @@ -66,9 +66,23 @@ (use-package cider :diminish :config + (defvar cider-main-function "-main") (defun cider-repl-mode-hook-fn () (display-line-numbers-mode -1) (subword-mode +1)) + (defun run-and-unhook () + (remove-hook 'cider-connected-hook 'run-and-unhook) + (run-main)) + (defun run-main () + (interactive) + (cider-insert-in-repl (concat "(" cider-main-function ")") t)) + (defun cider-jack-in-and-run-main (arg &rest params) + (interactive "P") + (if (equal current-prefix-arg '(4)) + (progn + (add-hook 'cider-connected-hook 'run-and-unhook) + (cider-jack-in params)) + (cider-jack-in params))) (define-abbrev-table 'cider-repl-mode-abbrev-table '(("scl" "(eval `(sc.api/defsc ~(sc.api/last-ep-id)))" cider-repl-return) ("scs" "(sc.api/defsc*)" cider-repl-return) |