Skip to content

Commit

Permalink
[Fix #1328] Auto-scroll the *nrepl-server* buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Oct 10, 2015
1 parent 761ea8d commit e2e4237
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* [#1241](https://github.com/clojure-emacs/cider/pull/1241): Passing a double prefix argument to `cider-refresh` will now clear the state of the namespace tracker used by the refresh middleware. This is useful for recovering from errors that a normal reload would not otherwise recover from, but may cause stale code in any deleted files to not be completely unloaded.
* New defcustom `cider-result-use-clojure-font-lock` allows you disable the use of Clojure font-locking for interactive results.
* [#1239](https://github.com/clojure-emacs/cider/issues/1239): New defcustom `cider-refresh-show-log-buffer`, controls the behaviour of the `*cider-refresh-log*` buffer when calling `cider-refresh`. When set to nil (the default), the log buffer will still be written to, but not displayed automatically. Instead, the most relevant information will be displayed in the echo area. When set to non-nil, the log buffer will be displayed every time `cider-refresh` is called.
* [#1328](https://github.com/clojure-emacs/cider/issues/1328): Auto-scroll the `*nrepl-server*` buffer on new output.

### Changes

Expand Down
13 changes: 10 additions & 3 deletions nrepl-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,16 @@ the port, and the client buffer."
(defun nrepl-server-filter (process output)
"Process nREPL server output from PROCESS contained in OUTPUT."
(with-current-buffer (process-buffer process)
(save-excursion
(goto-char (point-max))
(insert output)))
;; auto-scroll on new output
(let ((moving (= (point) (process-mark process))))
(save-excursion
(goto-char (process-mark process))
(insert output)
(set-marker (process-mark process) (point)))
(when moving
(goto-char (process-mark process))
(-when-let (win (get-buffer-window))
(set-window-point win (point))))))
(when (string-match "nREPL server started on port \\([0-9]+\\)" output)
(let ((port (string-to-number (match-string 1 output))))
(message "nREPL server started on %s" port)
Expand Down

0 comments on commit e2e4237

Please sign in to comment.