1

When I have two frames open with different R sessions in each, such as

+------------+------------+    +------------------+
| # file.R   |            |    |                  |
| 1+4        |            |    | > 1+2            |
|            |            |    | [1] 3            |
|            | > 1+1      |    | >                |
|            | [1] 2      |    +------------------+
|            | >          |    | 3  *R:2*         |
+------------+------------+    +------------------+
| 1  file.R  | 2  *R:1*   |
+------------+------------+

When I'm in window 1 and eval a line or region into *R:2*, emacs replaces window 2's *R:1* with *R:2*, so I now have it open in both frame-1-window-2 and frame-2-window-3.

+------------+------------+    +------------------+
| # file.R   |            |    | [1] 3            |
| 1+4        | > 1+2      |    | > 1+4            |
|            | [1] 3      |    | [1] 5            |
|            | > 1+4      |    | >                |
|            | [1] 5      |    +------------------+
|            | >          |    | 3  *R:2*         |
+------------+------------+    +------------------+
| 1  file.R  | 2  *R:2*   |
+------------+------------+

And I have to manually change window 2 back to *R:1*.

Since the *R:2* buffer is visible in frame 2, is there a way to prevent emacs from changing window 2? I believe that there is logic where if sourced code produces output and the buffer is not visible, then it is made visible. I think the issue here is that it is not visible in the current frame.

1 Answer 1

1

I think you can work around this by using the function ess-eval-line-invisibly-and-step, instead of ess-eval-line-visibly-and-step. The invisible version won't alter the current window arrangement. There isn't an invisible version for other ess-eval- functions, but most of them take a vis argument, so you could create your own wrappers if you like.

You could also try setting ess-eval-visibly to nil, which might solve the problem directly, and then you would only need to explicitly turn visibility back on when you wanted it.

1
  • Reassigning as (define-key ess-mode-map "\C-c\C-n" 'ess-eval-line-invisibly-and-step) was what did it. Thanks! (For the record, my ess-eval-visibly was already nil, no effect.)
    – r2evans
    Commented Jul 13, 2023 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.