Skip to content

Commit 514b47e

Browse files
committed
Possibly display error overlays on cider-load-buffer
Part of #3495
1 parent 20d8542 commit 514b47e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): display Java class/method/field info when available.
1212
- This info is available when [enrich-classpath](https://docs.cider.mx/cider/config/basic_config.html#use-enrich-classpath) is active.
13+
- [#3495](https://github.com/clojure-emacs/cider/issues/3495): possibly display error overlays on [`cider-load-buffer`](https://docs.cider.mx/cider/usage/code_evaluation.html#basic-evaluation).
1314
- `cider-popup-buffer-display`: honor `special-display-buffer-names` if customized for a given CIDER buffer name (e.g. `*cider-inspect*`), avoiding the double-rendering of the given buffer.
1415
- Bump the injected `cider-nrepl` to [0.43.0](https://github.com/clojure-emacs/cider-nrepl/blob/v0.43.0/CHANGELOG.md#0430-2023-11-04).
1516
- Improves performance for exception handling and other use cases.

cider-eval.el

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,16 @@ Optional argument DONE-HANDLER lambda will be run once load is complete."
951951
(cider-emit-interactive-eval-output value))
952952
(lambda (_buffer err)
953953
(cider-emit-interactive-eval-err-output err)
954-
(cider-handle-compilation-errors err eval-buffer))
954+
;; 1.- Jump to the error line:
955+
(cider-handle-compilation-errors err eval-buffer)
956+
(with-current-buffer eval-buffer
957+
(let* ((phase (cider--error-phase-of-last-exception buffer))
958+
;; 2.- Calculate the overlay position, which is the point (per the previous jump),
959+
;; and then end-of-line (for ensuring the overlay will be rendered properly):
960+
(end (save-excursion
961+
(end-of-line)
962+
(point))))
963+
(cider--maybe-display-error-as-overlay phase err end))))
955964
(lambda (buffer)
956965
(when cider-eval-register
957966
(set-register cider-eval-register res))

0 commit comments

Comments
 (0)