Skip to content

Commit

Permalink
[Fix #1252] Fix breakage in cider-repl-clear-buffer
Browse files Browse the repository at this point in the history
After running cider-repl-clear-buffer and then loading a file creating
output (e.g. because it contains println statements) the output would
appear in the wrong place, causing the prompt to disappear.

The problem was in the function responsible for putting POINT in the right
place before emitting evaluation results into the repl buffer.  When the
prompt was the first line in the buffer,
cider-repl--end-of-line-before-input-start didn't move point at all.
There's now a special case in place to handle this situation.

I initially considered solving this problem by making sure that the prompt
wasn't the first line in the buffer, after noticing that he banner was
being deleted by cider-repl-clear-buffer.  While I think the banner should
be preserved by this function, the banner itself is optional so this was a
non-solution.
  • Loading branch information
Lars Andersen committed Aug 17, 2015
1 parent a1e4d7c commit bb09497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Renamed `cider-repl-output-face` to `cider-repl-stdout-face` and `cider-repl-err-output-face` to `cider-repl-stderr-face`.

### Bugs fixed

* [#1252](https://github.com/clojure-emacs/cider/issues/1252) `cider-repl-clear-buffer` stops working in certain circumstances.
* [#1164](https://github.com/clojure-emacs/cider/pull/1164): Fix an error in `cider-browse-ns--doc-at-point`.
* [#1189](https://github.com/clojure-emacs/cider/issues/1189): Don't show result from automatic ns form evaluation.
* [#1079](https://github.com/clojure-emacs/cider/issues/1079): Don't try to font-lock very long results. The maximum font-lockable result length is controlled by `cider-font-lock-max-length`.
Expand Down
8 changes: 4 additions & 4 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,10 @@ text property `cider-old-input'."
"Return the position of the end of the line preceding the beginning of input."
(save-excursion
(goto-char cider-repl-input-start-mark)
;; do not use `previous-line', but `line-move' with noerror
;; moving up from the first line should not throw error
(line-move -1 t nil nil)
(line-end-position)))
(if (= (line-number-at-pos) 1)
(goto-char (point-min))
(line-move -1)
(line-end-position))))

(defun cider-repl-clear-output ()
"Delete the output inserted since the last input."
Expand Down

0 comments on commit bb09497

Please sign in to comment.