branch: elpa/cider
commit 292c6f108a055929fb5118dedba9c7461424580c
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Revert the REPL fringe-indicator guard, now unnecessary
    
    The guard in `cider--make-fringe-overlay' existed only because 
`cider-eval-last-sexp'
    was bound in the REPL and would leave a fringe marker there.  With that 
binding
    gone, the source-buffer eval path can no longer run in the REPL, so the 
guard
    (and its special-casing of the buffer's major mode) is no longer needed.
---
 lisp/cider-overlays.el      | 43 +++++++++++++++++++------------------------
 test/cider-overlay-tests.el | 27 ---------------------------
 2 files changed, 19 insertions(+), 51 deletions(-)

diff --git a/lisp/cider-overlays.el b/lisp/cider-overlays.el
index 70db631641..150094fe90 100644
--- a/lisp/cider-overlays.el
+++ b/lisp/cider-overlays.el
@@ -255,30 +255,25 @@ END is the position where the sexp ends, and defaults to 
point."
     (with-current-buffer (if (markerp end)
                              (marker-buffer end)
                            (current-buffer))
-      ;; The fringe indicators track a source form's load/eval state, which is
-      ;; meaningless in the REPL (and other non-source buffers), so only place
-      ;; them in Clojure source buffers.  `cider-eval-last-sexp' is bound in 
the
-      ;; REPL, so without this guard `C-x C-e' there would leave a marker.
-      (when (derived-mode-p 'clojure-mode 'clojure-ts-mode)
-        (save-excursion
-          (if end
-              (goto-char end)
-            (setq end (point)))
-          (clojure-forward-logical-sexp -1)
-          ;; Drop any prior indicator on this form (e.g. a stale one) so a
-          ;; re-evaluation replaces it with a fresh in-sync indicator.
-          (remove-overlays (point) end 'category 'cider-fringe-indicator)
-          ;; Create the green-circle overlay.
-          (let ((ov (cider--make-overlay (point) end 'cider-fringe-indicator
-                                         'before-string 
cider--fringe-overlay-good)))
-            (when cider-mark-stale-after-edit
-              ;; `cider--make-overlay' installs a delete-on-edit hook; swap 
just
-              ;; that one out for mark-stale, leaving any other hooks intact.
-              (overlay-put ov 'modification-hooks
-                           (cons #'cider--fringe-overlay-mark-stale
-                                 (remq #'cider--delete-overlay
-                                       (overlay-get ov 'modification-hooks)))))
-            ov))))))
+      (save-excursion
+        (if end
+            (goto-char end)
+          (setq end (point)))
+        (clojure-forward-logical-sexp -1)
+        ;; Drop any prior indicator on this form (e.g. a stale one) so a
+        ;; re-evaluation replaces it with a fresh in-sync indicator.
+        (remove-overlays (point) end 'category 'cider-fringe-indicator)
+        ;; Create the green-circle overlay.
+        (let ((ov (cider--make-overlay (point) end 'cider-fringe-indicator
+                                       'before-string 
cider--fringe-overlay-good)))
+          (when cider-mark-stale-after-edit
+            ;; `cider--make-overlay' installs a delete-on-edit hook; swap just
+            ;; that one out for mark-stale, leaving any other hooks intact.
+            (overlay-put ov 'modification-hooks
+                         (cons #'cider--fringe-overlay-mark-stale
+                               (remq #'cider--delete-overlay
+                                     (overlay-get ov 'modification-hooks)))))
+          ov)))))
 
 (cl-defun cider--make-result-overlay (value &rest props &key where duration 
(type 'result)
                                             (format (concat " " 
cider-eval-result-prefix "%s "))
diff --git a/test/cider-overlay-tests.el b/test/cider-overlay-tests.el
index 6f35e47f67..3c59f96a9b 100644
--- a/test/cider-overlay-tests.el
+++ b/test/cider-overlay-tests.el
@@ -22,8 +22,6 @@
 (require 'cl-lib)
 
 (require 'cider-overlays)
-(require 'clojure-mode)
-(require 'cider-repl)
 
 ;; Please, for each `describe', ensure there's an `it' block, so that its 
execution is visible in CI.
 
@@ -240,31 +238,6 @@ being set that way"
       (expect (cider--use-fringe-indicators-p 'eval) :to-be-truthy)
       (expect (cider--use-fringe-indicators-p 'test) :to-be-truthy))))
 
-(describe "cider--make-fringe-overlay"
-  (it "places an eval indicator in a Clojure source buffer"
-    (with-temp-buffer
-      (clojure-mode)
-      (insert "(+ 1 2)")
-      (let ((cider-fringe-indicators t))
-        (cider--make-fringe-overlay (point)))
-      (expect (seq-filter (lambda (o) (eq (overlay-get o 'category) 
'cider-fringe-indicator))
-                          (overlays-in (point-min) (point-max)))
-              :not :to-be nil)))
-
-  ;; Regression: `cider-eval-last-sexp' is bound to `C-x C-e' in the REPL, and
-  ;; the fringe indicators track source-form state, so they must not appear
-  ;; there.  `cider-repl-mode' is `fundamental-mode'-derived, so the
-  ;; source-buffer guard excludes it.
-  (it "does not place an indicator in the REPL buffer"
-    (with-temp-buffer
-      (setq major-mode 'cider-repl-mode)
-      (insert "(+ 1 2)")
-      (let ((cider-fringe-indicators t))
-        (cider--make-fringe-overlay (point)))
-      (expect (seq-filter (lambda (o) (eq (overlay-get o 'category) 
'cider-fringe-indicator))
-                          (overlays-in (point-min) (point-max)))
-              :to-be nil))))
-
 (describe "cider--eval-result-display"
   (it "passes the canonical values through unchanged"
     (dolist (mode '(overlay echo both errors-only))

Reply via email to