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?

David LeBauer
  • 31,011
  • 31
  • 115
  • 189

1 Answers1

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • @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-process – David LeBauer Dec 21 '10 at 22:16
  • 2
    @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. – VitoshKa Dec 22 '10 at 09:05
  • 1
    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. – aL3xa Dec 23 '10 at 12:49
  • Good point. Two-or-so years ago I learned about `uniquifi` which makes buffer switching so much better and easier -- see my amended answer. – Dirk Eddelbuettel Dec 23 '10 at 13:23
  • @Dirk `(global-set-key (kbd "C-x C-b") 'ibuffer)` makes my emacs hang – David LeBauer Jan 04 '11 at 01:45
  • 1
    Sorry to hear that. Works fine here on Ubuntu with standard packages and no local elisp packages or add-ons. – Dirk Eddelbuettel Jan 04 '11 at 01:47
  • Remarkable that after 10 years, the answer remains the same (I think) for ESS and emacs. Amazing! – seandavi Jun 25 '20 at 11:27
  • :) 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. – Dirk Eddelbuettel Jun 25 '20 at 12:01