branch: elpa/cider
commit 4e80ef14d1d2c487311b84a5e40f230b6d69da5d
Author: Oleksandr Yakushev <[email protected]>
Commit: Oleksandr Yakushev <[email protected]>

    [format] Fix cider-format when options are present
---
 CHANGELOG.md    |  1 +
 cider-client.el | 28 +++++++++++-----------------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f52fd9aecc3..994f1ccca35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
 - [orchard#353](https://github.com/clojure-emacs/orchard/pull/353): 
Stacktrace: flag Clojure functions as duplicate.
 - [orchard#355](https://github.com/clojure-emacs/orchard/pull/355): Java: 
resolve source files for non-base JDK classes.
 - [#3834](https://github.com/clojure-emacs/cider/issues/3834): Fix 
cider-ns-refresh throwing an error when a clojure REPL exists, but 
cider-current-repl does not support the required operations.
+- [#3848](https://github.com/clojure-emacs/cider/issues/3848): Format: fix 
cider-format crashing when format options are set.
 
 ## 1.19.0 (2025-07-10)
 
diff --git a/cider-client.el b/cider-client.el
index 7771b42d2f0..bb3b0852646 100644
--- a/cider-client.el
+++ b/cider-client.el
@@ -265,23 +265,17 @@ you need to encode it as the following plist:
 If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format
 the code.  See `cider-format-code-options' for details."
   (when format-options
-    (let* ((indents-dict (when (assoc "indents" format-options)
-                           (thread-last
-                             (cadr (assoc "indents" format-options))
-                             (map-pairs)
-                             (seq-mapcat #'identity)
-                             (apply #'nrepl-dict))))
-           (alias-map-dict (when (assoc "alias-map" format-options)
-                             (thread-last
-                               (cadr (assoc "alias-map" format-options))
-                               (map-pairs)
-                               (seq-mapcat #'identity)
-                               (apply #'nrepl-dict)))))
-      (nrepl-dict
-       `(,@(when indents-dict
-             `("indents" ,indents-dict))
-         ,@(when alias-map-dict
-             `("alias-map" ,alias-map-dict)))))))
+    (let* ((indents (cadr (assoc "indents" format-options)))
+           (alias-map (cadr (assoc "alias-map" format-options))))
+      (apply #'nrepl-dict
+             `(,@(when indents
+                   `("indents" ,(thread-last indents
+                                             (seq-mapcat #'identity)
+                                             (apply #'nrepl-dict))))
+               ,@(when alias-map
+                   `("alias-map" ,(thread-last alias-map
+                                               (seq-mapcat #'identity)
+                                               (apply #'nrepl-dict)))))))))
 
 (defcustom cider-print-fn 'pprint
   "Sets the function to use for printing.

Reply via email to