1

Add CIDER customizations

This commit is contained in:
Jessie Hildebrandt 2023-02-05 00:18:10 -05:00
parent 6e8df130f4
commit 08757871e4

42
init.el
View File

@ -908,13 +908,53 @@ DOCSTRING is an optional form that is discarded upon expansion."
;; cider ;; cider
;; ---------------------------------- ;; ;; ---------------------------------- ;;
(defun user/abbreviate-ns (namespace)
"Return NAMESPACE with all but the last name abbreviated."
(let* ((abbreviated-ns (cider-abbreviate-ns "some-class.wow.git-mirror-magic.core"))
(names (reverse (split-string abbreviated-ns "\\.")))
(last-name (car names)))
(concat (mapconcat (lambda (name)
(propertize (concat name ".")
'face 'font-lock-comment-face))
(reverse (cdr names))
"")
(propertize last-name
'face 'font-lock-doc-face))))
(external-package cider (external-package cider
"Provides an interactive programming environment for Clojure." "Provides an interactive programming environment for Clojure."
:custom
(nrepl-hide-special-buffers t "Hide REPL communications buffers from buffer lists.")
(cider-session-name-template "%j" "Label CIDER sessions with the short name of the current project.")
(cider-reply-display-in-current-window t "Use current window when creating a CIDER REPL buffer.")
(cider-use-fringe-indicators nil "Disable evaluation indicators in the fringe of CIDER buffers.")
(cider-repl-display-help-banner nil "Disable initial infodump in CIDER REPL buffers.")
(cider-repl-prompt-function (lambda (namespace)
(concat (user/abbreviate-ns namespace) "")))
:config
(setq nrepl-repl-buffer-name-template "*CIDER: %s (%r:%S)*"
cider--debug-buffer-format "*CIDER: Debugging %s*"
cider-inspector-buffer "*CIDER: Inspect*"
cider-error-buffer "*CIDER: Error*")
:commands
(cider)
:hook :hook
(clojure-mode-hook . cider-mode) (clojure-mode-hook . cider-mode)
:bind :bind
(:map clojure-mode-map
("C-c RET" . nil))
(:map cider-mode-map (:map cider-mode-map
("C-c RET" . nil))) ("C-c RET" . nil)
("C-c C-f" . cider-load-file)
("C-c C-b" . cider-load-buffer))
(:map cider-repl-mode-map
("C-c RET" . nil)
("C-c C-e" . end-of-buffer)
("C-<return>" . (lambda ()
(interactive)
(when (and (get-text-property (point) 'cider-old-input)
(< (point) cider-repl-input-start-mark))
(cider-repl--grab-old-input nil))))))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
;; consult ;; consult