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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

* [#3127](https://github.com/clojure-emacs/cider/pull/3040): Strip all exec-opts flags (`-A` `-M` `-T` `-X`) if they exist in `cider-clojure-cli-aliases`. Also addresses a duplicate `:` in the generated `clj` command.
* Enable `cider-enrich-classpath` by default.
* [#3148](https://github.com/clojure-emacs/cider/pull/3148): Display error messages in multiline comment eval results, and in result overlays when `cider-show-error-buffer` is set to nil.

### Bugs fixed

* Upgrade [enrich-classpath](https://github.com/clojure-emacs/enrich-classpath), which fixes various edge cases.
* Remember: at the moment the enrich-classpath is disabled by default. It will soon be enabled again. If you wish to try it out, you can customize `cider-enrich-classpath` to `t`.
* Also remember: for it to work, on Linux, you'll also have to do something like `sudo apt install openjdk-11-source` (depending on your package manager and JDK of choice).
* [#3145](https://github.com/clojure-emacs/cider/pull/3145): Allow fallback to other `xref` backends if cider-nrepl is not loaded.
* [#3148](https://github.com/clojure-emacs/cider/pull/3148): Fix eval result overlays at point inheriting the faces of following text.

## 1.2.0 (2021-12-22)

Expand Down
13 changes: 9 additions & 4 deletions cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,11 @@ when `cider-auto-inspect-after-eval' is non-nil."
(lambda (_buffer out)
(cider-emit-interactive-eval-output out))
(lambda (_buffer err)
(cider-emit-interactive-eval-err-output err)
(unless cider-show-error-buffer
;; Display errors as temporary overlays
(let ((cider-result-use-clojure-font-lock nil))
(cider--display-interactive-eval-result
err end 'cider-error-overlay-face)))
(cider-handle-compilation-errors err eval-buffer))
(when (and cider-auto-inspect-after-eval
(boundp 'cider-inspector-buffer)
Expand Down Expand Up @@ -815,7 +819,8 @@ COMMENT-POSTFIX is the text to output after the last line."
(lambda (_buffer value)
(setq res (concat res value)))
nil
nil
(lambda (_buffer err)
(setq res (concat res err)))
(lambda (buffer)
(with-current-buffer buffer
(save-excursion
Expand Down Expand Up @@ -1205,7 +1210,7 @@ buffer. It constructs an expression to eval in the following manner:
(cider-interactive-eval code
(when output-to-current-buffer
(cider-eval-print-handler))
nil
(list beg-of-defun (point))
(cider--nrepl-pr-request-map))))

(defun cider--matching-delimiter (delimiter)
Expand Down Expand Up @@ -1236,7 +1241,7 @@ buffer. It constructs an expression to eval in the following manner:
(cider-interactive-eval code
(when output-to-current-buffer
(cider-eval-print-handler))
nil
(list beg-of-sexp (point))
(cider--nrepl-pr-request-map))))

(defun cider-pprint-eval-defun-at-point (&optional output-to-current-buffer)
Expand Down
20 changes: 17 additions & 3 deletions cider-overlays.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ applied with lower priority than the syntax highlighting."
:group 'cider
:package-version '(cider "0.9.1"))

(defface cider-error-overlay-face
'((((class color) (background light))
:background "orange red")
(((class color) (background dark))
:background "firebrick"))
"Like `cider-result-overlay-face', but for evaluation errors."
:group 'cider
:package-version '(cider "0.25.0"))

(defcustom cider-result-use-clojure-font-lock t
"If non-nil, interactive eval results are font-locked as Clojure code."
:group 'cider
Expand Down Expand Up @@ -210,7 +219,9 @@ overlay."
(pcase cider-result-overlay-position
('at-eol (line-end-position))
('at-point (point)))))
(display-string (format format value))
;; Specify `default' face, otherwise unformatted text will
;; inherit the face of the following text.
(display-string (format (propertize format 'face 'default) value))
(o nil))
(remove-overlays beg end 'category type)
(funcall (if cider-overlays-use-font-lock
Expand Down Expand Up @@ -260,9 +271,11 @@ overlay."


;;; Displaying eval result
(defun cider--display-interactive-eval-result (value &optional point)
(defun cider--display-interactive-eval-result (value &optional point overlay-face)
"Display the result VALUE of an interactive eval operation.
VALUE is syntax-highlighted and displayed in the echo area.
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
Expand All @@ -274,7 +287,8 @@ focused."
(used-overlay (when (and point cider-use-overlays)
(cider--make-result-overlay font-value
:where point
:duration cider-eval-result-duration))))
:duration cider-eval-result-duration
:prepend-face (or overlay-face 'cider-result-overlay-face)))))
(message
"%s"
(propertize (format "%s%s" cider-eval-result-prefix font-value)
Expand Down
3 changes: 2 additions & 1 deletion doc/modules/ROOT/pages/usage/dealing_with_errors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ TIP: Use kbd:[q] to quickly close an error buffer.

By default, when an exception occurs, CIDER will display the exception
in an error buffer using `cider-stacktrace-mode`. You can suppress
this behavior, however:
this behavior, which causes just the error message to be output as a
temporary overlay or in the echo area:

[source,lisp]
----
Expand Down