Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [#3521](https://github.com/clojure-emacs/cider/issues/3521): Expand `cider-clojure-compilation-regexp` to also match e.g. `Unexpected error (ExceptionInfo) macroexpanding defmulti at (src/ns.clj:1:1).`.
- Remove module info from the [CIDER error overlay](https://docs.cider.mx/cider/usage/dealing_with_errors.html#configuration).
- Example string that is now trimmed away: `(java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')`
- [#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`.
- If specified, only errors will result in an overlay being shown.

## 1.8.2 (2023-10-15)

Expand Down Expand Up @@ -45,15 +47,14 @@
- [#3383](https://github.com/clojure-emacs/cider/issues/3383): `cider-connect-clj&cljs`: don't render `"ClojureScript REPL type:"` for JVM repls.
- [#3331](https://github.com/clojure-emacs/cider/issues/3331): `cider-eval`: never jump to spurious locations, as sometimes conveyed by nREPL.
- [#3112](https://github.com/clojure-emacs/cider/issues/3112): Fix the CIDER `xref-find-references` backend to return correct filenames.
- [#3393](https://github.com/clojure-emacs/cider/issues/3393): recompute namespace info on each shadow-cljs recompilation or evaluation.
- [#3402](https://github.com/clojure-emacs/cider/issues/3402): Fix `cider-format-connection-params` edge case for Emacs 29.
- [#3393](https://github.com/clojure-emacs/cider/issues/3393): Recompute namespace info on each shadow-cljs recompilation or evaluation.
- Recompute namespace info on each fighweel-main recompilation.
- [#3250](https://github.com/clojure-emacs/cider/issues/3250): Don't lose the CIDER session over TRAMP files.
- [#3413](https://github.com/clojure-emacs/cider/issues/3413): Make jump-to-definition work in projects needing `cider-path-translations` (i.e. Dockerized projects).
- [#2436](https://github.com/clojure-emacs/cider/issues/2436): Prevent malformed `cider-repl-history-file`s from failing `cider-jack-in`.
- [#3456](https://github.com/clojure-emacs/cider/issues/3456): Restore xref-based jump-to-definition in Babashka (and any nREPL clients not having cider-nrepl).
- [#3466](https://github.com/clojure-emacs/cider/issues/3466): Restore usual `cider--connected-handler` performance for JVM Clojure repls.
- [#3466](https://github.com/clojure-emacs/cider/issues/3466): Restore the usual `cider--connected-handler` performance for JVM Clojure repls.
- [#3503](https://github.com/clojure-emacs/cider/issues/3503): Make `cider-repl-set-ns` more reliable on Piggieback connections.
- Fix the `xref-find-definitions` CIDER backend to return correct filenames.
- Fix the `cider-xref-fn-deps` buttons to direct to the right file.
Expand Down
5 changes: 3 additions & 2 deletions cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ when `cider-auto-inspect-after-eval' is non-nil."
(nrepl-make-response-handler (or buffer eval-buffer)
(lambda (_buffer value)
(setq res (concat res value))
(cider--display-interactive-eval-result res end))
(cider--display-interactive-eval-result res 'value end))
(lambda (_buffer out)
(cider-emit-interactive-eval-output out))
(lambda (buffer err)
Expand All @@ -864,6 +864,7 @@ when `cider-auto-inspect-after-eval' is non-nil."
(string-trim))))
(cider--display-interactive-eval-result
trimmed-err
'error
end
'cider-error-overlay-face)))

Expand Down Expand Up @@ -897,7 +898,7 @@ Optional argument DONE-HANDLER lambda will be run once load is complete."
(res ""))
(nrepl-make-response-handler (or buffer eval-buffer)
(lambda (buffer value)
(cider--display-interactive-eval-result value)
(cider--display-interactive-eval-result value 'value)
(when cider-eval-register
(setq res (concat res value)))
(when (buffer-live-p buffer)
Expand Down
14 changes: 11 additions & 3 deletions cider-overlays.el
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ font-locking it."
(defcustom cider-use-overlays 'both
"Whether to display evaluation results with overlays.
If t, use overlays determined by `cider-result-overlay-position'.
If `errors-only', use overlays determined by `cider-result-overlay-position',
but only for error messages - other messages will be displayed on the echo area.
If nil, display on the echo area.
If both, display on both places.
If `both', display on both places.

Only applies to evaluation commands. To configure the debugger overlays,
see `cider-debug-use-overlays'."
Expand Down Expand Up @@ -290,21 +292,27 @@ overlay."


;;; Displaying eval result
(defun cider--display-interactive-eval-result (value &optional point overlay-face)
(defun cider--display-interactive-eval-result (value value-type &optional point overlay-face)
"Display the result VALUE of an interactive eval operation.
VALUE is syntax-highlighted and displayed in the echo area.
VALUE-TYPE is one of: `value', `error'.
OVERLAY-FACE is the face applied to the overlay, which defaults to
`cider-result-overlay-face' if nil.
If POINT and `cider-use-overlays' are non-nil, it is also displayed in an
overlay at the end of the line containing POINT.
Note that, while POINT can be a number, it's preferable to be a marker, as
that will better handle some corner cases where the original buffer is not
focused."
(cl-assert (symbolp value-type)) ;; We assert because for avoiding confusion with the optional args.
(let* ((font-value (if cider-result-use-clojure-font-lock
(cider-font-lock-as-clojure value)
value))
(font-value (string-trim-right font-value))
(used-overlay (when (and point cider-use-overlays)
(used-overlay (when (and point
cider-use-overlays
(if (equal 'error value-type)
t
(not (equal 'errors-only cider-use-overlays))))
(cider--make-result-overlay font-value
:where point
:duration cider-eval-result-duration
Expand Down
14 changes: 12 additions & 2 deletions doc/modules/ROOT/pages/usage/code_evaluation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,18 @@ variable.
(setq cider-overlays-use-font-lock t)
----

You can disable overlays entirely (and display results in the echo-area at the
bottom) with the `cider-use-overlays` variable.
If you don't like seeing overlays so often,
you can restrict overlays to only be shown for errors
(and display non-error results in the echo area at the bottom)
by customizing the `cider-use-overlays` variable:

[source,lisp]
----
(setq cider-use-overlays 'errors-only)
----

You can disable overlays entirely (and display results in the echo area at the
bottom) with the `cider-use-overlays` variable:

[source,lisp]
----
Expand Down