Skip to content

Commit

Permalink
Fix performance in fringe overlay placement
Browse files Browse the repository at this point in the history
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
  • Loading branch information
phillord authored and bbatsov committed Apr 3, 2017
1 parent c538d35 commit ea030a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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.
Expand Down
8 changes: 6 additions & 2 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit ea030a5

Please sign in to comment.