Skip to content

Delete overlays when clearing REPL buffer #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and try to associate the created connection with this project automatically.
* [#1479](https://github.com/clojure-emacs/cider/pull/1479): Make paredit and `cider-repl-mode` play nice.
* [#1452](https://github.com/clojure-emacs/cider/issues/1452): Prevent ANSI color overlays in the REPL buffer from being extended.
* [#1486](https://github.com/clojure-emacs/cider/issues/1486): Complete a partial fix in stacktrace font-locking.
* [#1488](https://github.com/clojure-emacs/cider/pull/1488): Delete zombie overlays in the REPL buffer.

## 0.10.0 / 2015-12-03

Expand Down
11 changes: 8 additions & 3 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,17 @@ text property `cider-old-input'."

(defvar cider-repl-clear-buffer-hook)

(defun cider-repl--clear-region (start end)
"Delete the output and its overlays between START and END."
(mapc 'delete-overlay (overlays-in start end))
(delete-region start end))

(defun cider-repl-clear-buffer ()
"Delete the output generated by the Clojure process."
(interactive)
(let ((inhibit-read-only t))
(delete-region (point-min) cider-repl-prompt-start-mark)
(delete-region cider-repl-output-start cider-repl-output-end)
(cider-repl--clear-region (point-min) cider-repl-prompt-start-mark)
(cider-repl--clear-region cider-repl-output-start cider-repl-output-end)
(when (< (point) cider-repl-input-start-mark)
(goto-char cider-repl-input-start-mark))
(recenter t))
Expand All @@ -773,7 +778,7 @@ With a prefix argument CLEAR-REPL it will clear the entire REPL buffer instead."
(end (cider-repl--end-of-line-before-input-start)))
(when (< start end)
(let ((inhibit-read-only t))
(delete-region start end)
(cider-repl--clear-region start end)
(save-excursion
(goto-char start)
(insert
Expand Down