How can I switch between R sessions in emacs-ess?
Asked Answered
K

1

18

I have two sessions open in Emacs-ESS: one on my desktop and one on a server using tramp. How can I tell ESS which session to use?

Knockknee answered 21/12, 2010 at 21:48 Comment(0)
E
21

Well I use

M-x ess-switch-process

all the time to switch between my (local) R sessions inside Emacs. Sections 3.2 has details.

Edit As a follow-up to aL3xa's comment, I also have these in a my dot.emacs:

(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
; Slightly more debatable
(global-set-key (kbd "C-x C-b") 'ibuffer)

which makes the process switch much nicer. Kudos to CGWalters, another Emacs user from whom I copied this.

Earthaearthborn answered 21/12, 2010 at 21:54 Comment(8)
@Dirk thanks - that works now; I was trying to do this before starting a new process, but now I see that I need to do M-x ess-start-process and then M-x ess-switch-processKnockknee
@David, ess-switch-process is bound to C-c C-s, also a related functionality is C-c C-k from iESS which allows for easy navigation between iESS buffers.Lookthrough
Another "solution" is to use C-x b and type *R followed by desired session ID. It's a native Emacs feature (it's not ESS-specific). You'll see previously used buffer name in minibufer as default, so if you switch between two R sessions, this can be quite handy.Piselli
Good point. Two-or-so years ago I learned about uniquifi which makes buffer switching so much better and easier -- see my amended answer.Earthaearthborn
@Dirk (global-set-key (kbd "C-x C-b") 'ibuffer) makes my emacs hangKnockknee
Sorry to hear that. Works fine here on Ubuntu with standard packages and no local elisp packages or add-ons.Earthaearthborn
Remarkable that after 10 years, the answer remains the same (I think) for ESS and emacs. Amazing!Sacring
:) Why would Emacs or ESS change in such a short time span? That said I had forgotten about the uniquify snippet which I no longer use. Adding it back does not seem to hurt though.Earthaearthborn

© 2022 - 2024 — McMap. All rights reserved.