Skip to content

Commit 5fd93f6

Browse files
committed
PR feedback
1 parent d9a0f87 commit 5fd93f6

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- [#3522](https://github.com/clojure-emacs/cider/issues/3522): Introduce a new possible value for [`cider-use-overlays`](https://docs.cider.mx/cider/usage/code_evaluation.html#overlays): `errors-only`.
1111
- If specified, only errors will result in an overlay being shown.
1212
- [#3527](https://github.com/clojure-emacs/cider/issues/3527): Preserve the font size as one navigates through the CIDER inspector.
13-
- [#3525](https://github.com/clojure-emacs/cider/issues/3525): Introduce [`cider-shorten-error-overlays`](https://docs.cider.mx/cider/usage/code_evaluation.html#overlays) customization option.
13+
- [#3525](https://github.com/clojure-emacs/cider/issues/3525): Introduce [`cider-inline-error-message-function`](https://docs.cider.mx/cider/usage/code_evaluation.html#overlays) customization option.
1414

1515
## 1.8.2 (2023-10-15)
1616

cider-eval.el

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -821,13 +821,15 @@ REPL buffer. This is controlled via
821821
conn)))
822822
(nrepl-dict-get result "phase"))))))
823823

824-
(defcustom cider-shorten-error-overlays t
825-
"If t, overlays that reflect error messages will be more concise.
826-
Specifically, the prefix matched by `cider-clojure-compilation-regexp',
827-
and the suffix matched by `cider-module-info-regexp' will be removed."
824+
(defcustom cider-inline-error-message-function #'cider--shorten-error-message
825+
"A function that will shorten a given error message,
826+
as shown in overlays / the minibuffer (per `cider-use-overlays').
827+
828+
The function takes a single arg. You may want to use `identity',
829+
for leaving the message as-is."
828830
:type 'boolean
829831
:group 'cider
830-
:package-version '(cider . "0.19.0"))
832+
:package-version '(cider . "1.19.0"))
831833

832834
(defun cider--shorten-error-message (err)
833835
"Removes from ERR the prefix matched by `cider-clojure-compilation-regexp',
@@ -874,9 +876,7 @@ when `cider-auto-inspect-after-eval' is non-nil."
874876
(member phase cider-clojure-compilation-error-phases)))
875877
;; Display errors as temporary overlays
876878
(let ((cider-result-use-clojure-font-lock nil)
877-
(trimmed-err (if cider-shorten-error-overlays
878-
(cider--shorten-error-message err)
879-
err)))
879+
(trimmed-err (funcall cider-inline-error-message-function err)))
880880
(cider--display-interactive-eval-result
881881
trimmed-err
882882
'error

doc/modules/ROOT/pages/usage/code_evaluation.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ bottom) with the `cider-use-overlays` variable:
208208
----
209209

210210
Overlays that indicate errors are by default trimmed of file/line/phase information.
211-
If you find it useful, you can customize:
212211

212+
(Example: the entire `Syntax error compiling at (src/ns.clj:227:3).` preamble)
213+
214+
You can prevent any trimming by customizing instead:
213215

214216
[source,lisp]
215217
----
216-
(setq cider-shorten-error-overlays nil)
218+
(setq cider-inline-error-message-function #'identity)
217219
----
218220

219221
By default, result overlays are displayed at the end of the line. You can set

0 commit comments

Comments
 (0)