Skip to content

Commit 4e80ef1

Browse files
[format] Fix cider-format when options are present
1 parent 6289002 commit 4e80ef1

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [orchard#353](https://github.com/clojure-emacs/orchard/pull/353): Stacktrace: flag Clojure functions as duplicate.
2323
- [orchard#355](https://github.com/clojure-emacs/orchard/pull/355): Java: resolve source files for non-base JDK classes.
2424
- [#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.
25+
- [#3848](https://github.com/clojure-emacs/cider/issues/3848): Format: fix cider-format crashing when format options are set.
2526

2627
## 1.19.0 (2025-07-10)
2728

cider-client.el

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,23 +265,17 @@ you need to encode it as the following plist:
265265
If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format
266266
the code. See `cider-format-code-options' for details."
267267
(when format-options
268-
(let* ((indents-dict (when (assoc "indents" format-options)
269-
(thread-last
270-
(cadr (assoc "indents" format-options))
271-
(map-pairs)
272-
(seq-mapcat #'identity)
273-
(apply #'nrepl-dict))))
274-
(alias-map-dict (when (assoc "alias-map" format-options)
275-
(thread-last
276-
(cadr (assoc "alias-map" format-options))
277-
(map-pairs)
278-
(seq-mapcat #'identity)
279-
(apply #'nrepl-dict)))))
280-
(nrepl-dict
281-
`(,@(when indents-dict
282-
`("indents" ,indents-dict))
283-
,@(when alias-map-dict
284-
`("alias-map" ,alias-map-dict)))))))
268+
(let* ((indents (cadr (assoc "indents" format-options)))
269+
(alias-map (cadr (assoc "alias-map" format-options))))
270+
(apply #'nrepl-dict
271+
`(,@(when indents
272+
`("indents" ,(thread-last indents
273+
(seq-mapcat #'identity)
274+
(apply #'nrepl-dict))))
275+
,@(when alias-map
276+
`("alias-map" ,(thread-last alias-map
277+
(seq-mapcat #'identity)
278+
(apply #'nrepl-dict)))))))))
285279

286280
(defcustom cider-print-fn 'pprint
287281
"Sets the function to use for printing.

0 commit comments

Comments
 (0)