In ESS/Emacs, how can I get the R process buffer to scroll to the bottom after a C-c C-j or C-c C-r
Asked Answered
E

3

18

In ESS when I am evaluating chunks of code in a .R file using C-c C-j or C-c C-r (to send the line or region to a running R process), how can I get the R buffer to scroll down automatically, such that after evaluating a region the cursor is at the bottom, at the prompt?

Thanks.

Electroballistics answered 25/4, 2010 at 23:53 Comment(0)
T
27

Probably a bunch of ways to do it. In my .emacs.d I have

  (setq comint-prompt-read-only t)
  (setq comint-scroll-to-bottom-on-input t)
  (setq comint-scroll-to-bottom-on-output t)
  (setq comint-move-point-for-output t)

You might also be interested in this code, originally from Felipe Csaszar, which lets you do what you ask and a few other nice things besides.

Turoff answered 26/4, 2010 at 0:22 Comment(3)
(setq comint-prompt-read-only t) is likely a bad idea. I used to have this whole block of commands in .emacs (as copied from emacswiki), but (setq comint-prompt-read-only t) would sometimes break the interaction between the buffer and inferior ESS process, forcing me to kill R and start session over.Besought
I too have found that read-only can lead to issues with ESS. Beware.Bristol
Yeah, I removed it myself ages ago as well.Turoff
E
1

Have a look at auto-scrolling in emacs doc. For my part:

customize-variable RET scroll-down-aggressively RET

scroll-down-aggressively set to 1 did the job.

Effusion answered 20/8, 2015 at 15:38 Comment(1)
working for me with Python console, not tried with R oneValerio
B
-1

DJJ's solution works perfectly for ESS and polymode in Spacemacs.

First, put (scroll-down-aggressively 1) within the defun dotspacemacs/user-config () section of the configuration file, e.g. ~/.spacemacs.

Then, evaluate the line using SPC , e r or restart configuration SPC f e d.

Emacs 27 complained about the above line because "Symbol's function definition is void" so I had to change it as follow to achieve the same result:

(setq scroll-down-aggressively 0.01)
Boscage answered 24/4, 2019 at 11:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.