emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 151b02b387: Introduce `errors-only` value for `cider


From: ELPA Syncer
Subject: [nongnu] elpa/cider 151b02b387: Introduce `errors-only` value for `cider-use-overlays` (#3524)
Date: Mon, 16 Oct 2023 15:59:56 -0400 (EDT)

branch: elpa/cider
commit 151b02b3875ef66d0fd83f2e60990f857de17c43
Author: vemv <vemv@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Introduce `errors-only` value for `cider-use-overlays` (#3524)
    
    Fixes https://github.com/clojure-emacs/cider/issues/3522
---
 CHANGELOG.md                                      |  5 +++--
 cider-eval.el                                     |  5 +++--
 cider-overlays.el                                 | 14 +++++++++++---
 doc/modules/ROOT/pages/usage/code_evaluation.adoc | 14 ++++++++++++--
 4 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e602a3cbf..80b0a37e8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
 
@@ -45,7 +47,6 @@
 - [#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.
@@ -53,7 +54,7 @@
 - [#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.
diff --git a/cider-eval.el b/cider-eval.el
index 9e4206ba0d..33fc97b60a 100644
--- a/cider-eval.el
+++ b/cider-eval.el
@@ -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)
@@ -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)))
 
@@ -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)
diff --git a/cider-overlays.el b/cider-overlays.el
index c9f565a4ab..487aec03d2 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -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'."
@@ -290,9 +292,10 @@ 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
@@ -300,11 +303,16 @@ 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
diff --git a/doc/modules/ROOT/pages/usage/code_evaluation.adoc 
b/doc/modules/ROOT/pages/usage/code_evaluation.adoc
index b67929cbb2..612530b1bd 100644
--- a/doc/modules/ROOT/pages/usage/code_evaluation.adoc
+++ b/doc/modules/ROOT/pages/usage/code_evaluation.adoc
@@ -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]
 ----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]