From 4e78b6f3563e628417777f90e00dffdea5f9cfac Mon Sep 17 00:00:00 2001 From: Jessie Hildebrandt Date: Thu, 16 Mar 2023 11:42:27 -0400 Subject: [PATCH] Expand CIDER customizations --- init.el | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/init.el b/init.el index d517d46..8eb0e75 100644 --- a/init.el +++ b/init.el @@ -932,9 +932,16 @@ DOCSTRING is an optional form that is discarded upon expansion." ;; 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")) +(defun user/cider-error-buffer () + "Switch to the CIDER error buffer, if it exists." + (interactive) + (if (get-buffer cider-error-buffer) + (pop-to-buffer cider-error-buffer) + (message "No active CIDER stacktrace buffer."))) + +(defun user/prettify-cider-namespace (namespace) + "Return NAMESPACE formatted and with all but the last name abbreviated." + (let* ((abbreviated-ns (cider-abbreviate-ns namespace)) (names (reverse (split-string abbreviated-ns "\\."))) (last-name (car names))) (concat (mapconcat (lambda (name) @@ -949,30 +956,26 @@ DOCSTRING is an optional form that is discarded upon expansion." "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-show-error-buffer nil "Disable automatic display of the CIDER stacktrace info buffer.") (cider-use-fringe-indicators nil "Disable evaluation indicators in the fringe of CIDER buffers.") + (cider-session-name-template "%j" "Label CIDER sessions with the short name of the current project.") + (cider-eval-spinner-type ["" "" "" "" "" ""] "Use an activity spinner that utilizes Fira Code glyphs.") + (cider-eval-spinner-delay 0.5 "Show the evaluation activity spinner after 0.5 seconds of activity.") (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) + (cider-repl-prompt-function (lambda (namespace) (concat (user/prettify-cider-namespace namespace) " ❱ "))) :hook (clojure-mode-hook . cider-mode) + (cider-repl-mode-hook . electric-pair-local-mode) :bind - (:map clojure-mode-map - ("C-c RET" . nil)) (:map cider-mode-map - ("C-c RET" . nil) + ("M-." . cider-find-var) + ("M-," . cider-pop-back) + ("C-c m" . cider-macroexpand-1) ("C-c C-f" . cider-load-file) - ("C-c C-b" . cider-load-buffer)) + ("C-c C-b" . cider-load-buffer) + ("C-c C-\\" . cider-format-buffer) + ("C-c M-e" . user/cider-error-buffer)) (:map cider-repl-mode-map - ("C-c RET" . nil) ("C-c C-e" . end-of-buffer) ("C-" . (lambda () (interactive)