0

This is two questions in one:

  • What is the best way of ordering windows in Emacs - and have them enabled as such in .emacs so that the R console and editor are on the right, and R Dired help and R View on the left? Some thing like
    *-----------*---------*
    | R console | R view  |
    *-----------*---------*
    | editor    | R Dired |
    *-----------*---------*

Or the editor on top and console on the bottom ... but I like my working environment on the left, and explorations/help on the right. Currently I have R Dired opening on the right, but viewing a dataframe opens up in the window of the R console.

  • How can I have a help file open up within emacs? I want help to open up in a window on the right, but at the moment help files open up in a browser window. I have set
(setq browse-url-browser-function 'eww-browse-url)

in my .emacs, but it doesn't seem to make any difference.

Note that I'm using Windows 10 here, with GNU Emacs 26.3 (build 1, x86_64-w64-mingw32). However, I would have thought that most emacs command should be system-agnostic.

I have also based my configuration file on the very detailed example given here.

I am not new to Emacs; relatively new to R, and completely new to ESS!

Thanks, Alasdair

Alasdair
  • 1,300
  • 4
  • 16
  • 28
  • Do you have to set `options(help_type="text")` in R too? – thelatemail Aug 27 '21 at 02:55
  • Thanks, but I don't know - I assumed that since eww and other emacs browsers can work with html files, all I needed to do was to redirect help pages to them. But it seems not... – Alasdair Aug 27 '21 at 09:46
  • Yes, setting that option worked - thank you! Is it possible to add R options in the `.emacs` file? For teaching I'd use RStudio, in which case I don't want that option - so I don't want to set it globally in `.Rprofile`. – Alasdair Aug 30 '21 at 02:37
  • You might be able to check if R is running in RStudio via something here - https://stackoverflow.com/questions/12389158/check-if-r-is-running-in-rstudio - and only set the `help_type` if it returns FALSE. – thelatemail Sep 01 '21 at 00:24

1 Answers1

0

To configure the window you can set the variable "display-buffer-alist" in your emacs configuration file. Take a look to this example and adapt it to your needs:

;; An example of window configuration:
(setq display-buffer-alist
      '(("*R Dired"
     (display-buffer-reuse-window display-buffer-at-bottom)
     (window-width . 0.5)
     (window-height . 0.25)
     (reusable-frames . nil))
    ("*R"
     (display-buffer-reuse-window display-buffer-in-side-window)
     (side . right)
     (slot . -1)
     (window-width . 0.5)
     (reusable-frames . nil))
    ("*Help"
     (display-buffer-reuse-window display-buffer-in-side-window)
     (side . right)
     (slot . 1)
     (window-width . 0.5)
     (reusable-frames . nil))))

This code is from: https://github.com/ess-intro/presentation-ess-customization/blob/main/tutorial/ess-init.el

Jose
  • 421
  • 3
  • 10