From dbc10b02e4c0c7be543e2026847f3bd8f81ff7b1 Mon Sep 17 00:00:00 2001 From: lane-s Date: Sun, 7 Jul 2024 08:25:54 +0200 Subject: [PATCH 1/2] lispy-eval: improve condition for deciding overlay We prioritize using eros if available, but we make sure not to use it if we're in a clojure mode and cider is installed. This fixed an issue where lisp modes that didn't use cider weren't able to display evaluation results with an overlay because lispy was passing a string argumet to cider--display-interactive-eval-result, which now requires a symbol. --- lispy.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lispy.el b/lispy.el index 0c5c9720..95803e7e 100644 --- a/lispy.el +++ b/lispy.el @@ -4244,21 +4244,23 @@ When at an outline, eval the outline." (looking-at lispy-outline-header)) (lispy-eval-outline)) (t - (let ((res (lispy--eval e-str))) + (let ((res (lispy--eval e-str)) + (has-cider (or (fboundp 'cider--display-interactive-eval-result) + (require 'cider nil t)))) (when (memq major-mode lispy-clojure-modes) (setq res (lispy--clojure-pretty-string res))) (when lispy-eval-output (setq res (concat lispy-eval-output res))) (cond ((eq lispy-eval-display-style 'message) (lispy-message res)) - ((or (fboundp 'cider--display-interactive-eval-result) - (require 'cider nil t)) - (cider--display-interactive-eval-result - res (cdr (lispy--bounds-dwim)))) - ((or (fboundp 'eros--eval-overlay) - (require 'eros nil t)) + ((and (or (fboundp 'eros--eval-overlay) + (require 'eros nil t)) + (if has-cider (not (memq major-mode lispy-clojure-modes)) t)) (eros--eval-overlay res (cdr (lispy--bounds-dwim)))) + (has-cider + (cider--display-interactive-eval-result + res (cdr (lispy--bounds-dwim)))) (t (error "Please install CIDER >= 0.10 or eros to display overlay")))))) (eval-error From c7caa4f2dff89bd553379f74931e0cc167e54380 Mon Sep 17 00:00:00 2001 From: lane-s Date: Sun, 7 Jul 2024 09:24:40 +0200 Subject: [PATCH 2/2] Fix display with eros Since eros (at least at a9a92bdc6be0521a6a06eb464be55ed61946639c) uses `format` to display the object we pass, we won't have a correct result unless we use `read` here. --- lispy.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispy.el b/lispy.el index 95803e7e..8faa4073 100644 --- a/lispy.el +++ b/lispy.el @@ -4257,7 +4257,7 @@ When at an outline, eval the outline." (require 'eros nil t)) (if has-cider (not (memq major-mode lispy-clojure-modes)) t)) (eros--eval-overlay - res (cdr (lispy--bounds-dwim)))) + (read res) (cdr (lispy--bounds-dwim)))) (has-cider (cider--display-interactive-eval-result res (cdr (lispy--bounds-dwim))))