diff --git a/elisp/ghc-process.el b/elisp/ghc-process.el index d6d4a35..7de4bb3 100644 --- a/elisp/ghc-process.el +++ b/elisp/ghc-process.el @@ -110,9 +110,15 @@ (goto-char (point-max)) (insert-buffer-substring tbuf 1 end)) (with-current-buffer (get-buffer-create ghc-error-buffer) - (goto-char (point-max)) - (insert-buffer-substring tbuf 1 end) - (display-buffer (current-buffer)) + (let* ((cbuf (current-buffer)) + cwin) + (unless (get-buffer-window cbuf) (display-buffer cbuf)) + (setq cwin (get-buffer-window cbuf)) + (goto-char (point-max)) + (insert-buffer-substring tbuf 1 end) + (unless (pos-visible-in-window-p (point) cwin) + (with-selected-window cwin + (scroll-up 2)))) (redisplay))) (delete-region 1 end))))) (goto-char (point-max))