[ESS] When the R window opens, sometimes it is side-by-side with my .Rnw file. I want them one above the other. It seems unpredictable

Stephen Eglen @je30 @end|ng |rom c@m@@c@uk
Fri May 27 23:53:28 CEST 2022


> I'm using Vince Goulet's modified version of emacs 26.2 (build 1,
> x86_64-w64-mingw32)  of 2019-04-13 with ESS, on Windows 10. I use Sweave
> and LaTeX, so I have my R code in .Rnw files. When I execute my first
> line of R code, an R buffer opens of course. I prefer it to be below my
> Rnw buffer. Sometimes it is. But other times the R buffer opens to the
> side. It's unpredictable, which is disconcerting; I have not been able
> to discern a pattern.  How can I ensure that every time emacs/ESS opens
> an R buffer, the emacs window is split top-and-bottom, rather than
> side-by-side.

hi Chris,

I'm afraid that even after using Emacs for 30 years, I still find it
unpredictable where buffers will appear.  It has got much worse in
recent years with widescreen monitors (on old terminals the splits used
to be primarily above/below, rather than left/right).

There are some variables you can investigate to help give Emacs some
clues:

;; (setq split-height-threshold nil)
;; (setq split-width-threshold 75)

and display-buffer-alist

(info "(elisp)Window Parameters")

In Emacs 28 there are a couple of new keybindings that help a bit:

----------------------------------------------------------------------
*** The key prefix 'C-x 4 1' displays next command buffer in the same window.
It's bound to the command 'same-window-prefix' that requests the buffer
of the next command to be displayed in the same window.

*** The key prefix 'C-x 4 4' displays next command buffer in a new window.
It's bound to the command 'other-window-prefix' that requests the buffer
of the next command to be displayed in a new window.
----------------------------------------------------------------------

but still that does not help exactly with the direction of split.

I've taken the view instead that Emacs is a bit like LaTeX -- where you
can't always control where it will put figures/tables.

Stephen



More information about the ESS-help mailing list