5

I am (really) new in Emacs and ESS, and I am currently trying to customize my environment. The default settings of ESS[R] are convenient for me, since ESS[R] organizes the windows as follows:

-----------------------------
|   ESS[R]    |    *R*      |
|  (R code)   | (R console) |
|             |             |
|             |             |
-----------------------------

But one thing I don't like is that, when you call an help page (or when using the C-c C-v shortcut), the default is to display the help page instead of the R buffer, like that:

-----------------------------
|   ESS[R]    |  *help[R]*  |
|  (R code)   |             |
|             |             |
|             |             |
-----------------------------

I would like the help buffer to be displayed just below the R buffer instead, like that:

-----------------------------
|   ESS[R]    |    *R*      |
|  (R code)   | (R console) |
|             |-------------|
|             |  *help[R]*  |
|             |             |
-----------------------------

But I don't manage to do that. I read carefully the manual, but I should have missed something. I added the following instructions in my .emacs file:

 '(display-buffer-alist
   (quote
    (("*Help"
      (display-buffer-at-bottom)
      (slot . 1)
      (side . right)
      (window-width . 0.5)))))

but it does not work, since the help buffer is displayed below the two other, with a width of 1. What should I do to get the window organization I want?

Drew
  • 75,699
  • 9
  • 109
  • 225
Philopolis
  • 1,094
  • 8
  • 14
  • 3
    One quick and simple way is to make `*Help*` a "special buffer" so it gets a dedicated window: customize option `special-display-buffer-names`, adding `"*Help*"` to it. – Drew May 22 '19 at 13:33

1 Answers1

1

Thanks @Drew for your answer, but it did not work (maybe I did not made it correctly :-)). I tried to add this in my .emacs file:

(setq special-display-buffer-names
      '("*Help" "*help[R]*" "*Help*"))

but nothing changed. Then, I tried various settings for the variable ess-help-frame-alist, and I did not manage neither...

However, I finally found a solution! The following code is okay, and I think it was necessary to set the parameters of the R frame before the parameters of the Help frame:

(setq display-buffer-alist '(("*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))))

Not so easy, but functional. :-)

Thanks again!

Philopolis
  • 1,094
  • 8
  • 14
  • 1
    My recollection is that the `display-buffer-alist` uses regex for buffer names. An asterisk is not a literal asterisk unless it looks like `\\*` or `[*]` -- there may be other forms for literals, but I'm not that fluent in reg-speak. If your intention is to use the asterisk as something other than a literal asterisk, then just disregard my comment ... – lawlist May 22 '19 at 22:16
  • 1
    @lawlist is correct in general, but `"*R"` and `"*Help"` will actually be working as intended, because certain metacharacters match literally when they appear in positions where their usual behaviour makes no sense. In this instance `*` as the very first character of the regexp makes no sense as a metacharacter, and consequently it actually matches a literal `*`. This behaviour is not very intuitive, however, and I would not recommend making intentional use of it -- it is cleaner to always use escaping in these situations, even if it's not strictly necessary. – phils Oct 21 '19 at 22:46