From db6bd3d422a3ba1a0aa398ec74eef9a794c7954d Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Sat, 18 Mar 2017 21:58:42 +0000 Subject: [PATCH] Fix performance in fringe overlay placement Multiple identical fringe overlays were being placed by overlays were being added to the entire region for every interactive eval in that region. Add check in cider-interactive-eval-handler, so only first value adds fringe overlays. Remove all fringe overlays in region before placing new ones. Addresses #1962 --- CHANGELOG.md | 1 + cider-interaction.el | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3cc214d1..f07127ea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ ### Bugs Fixed +* [#1962](https://github.com/clojure-emacs/cider/issues/1962): Fix performance in fringe overlay placement * [#1947](https://github.com/clojure-emacs/cider/issues/1947): Fix error on `cider-jack-in` when `enlighten-mode` is enabled. * [#1588](https://github.com/clojure-emacs/cider/issues/1588): Redirect `*err*`, `java.lang.System/out`, and `java.lang.System/err` to REPL buffer on all attached sessions. * [#1707](https://github.com/clojure-emacs/cider/issues/1707): Allow to customize line truncating in CIDER's special buffers. diff --git a/cider-interaction.el b/cider-interaction.el index 0c2a29cc0..2c5e59fe4 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -693,6 +693,7 @@ REPL buffer. This is controlled via (current-buffer)) (save-excursion (goto-char beg) + (remove-overlays beg end 'cider-fringe-indicator) (condition-case nil (while (progn (clojure-forward-logical-sexp) (and (<= (point) end) @@ -709,11 +710,14 @@ or it can be a list with (START END) of the evaluated region." (beg (car-safe place)) (end (or (car-safe (cdr-safe place)) place)) (beg (when beg (copy-marker beg))) - (end (when end (copy-marker end)))) + (end (when end (copy-marker end))) + (fringed nil)) (nrepl-make-response-handler (or buffer eval-buffer) (lambda (_buffer value) (if beg - (cider--make-fringe-overlays-for-region beg end) + (unless fringed + (cider--make-fringe-overlays-for-region beg end) + (setq fringed t)) (cider--make-fringe-overlay end)) (cider--display-interactive-eval-result value end)) (lambda (_buffer out)