How do I rename R sessions in ESS?
Asked Answered
P

2

8

I previously asked how to switch R sessions in ESS, and the use of C-x C-s has sped up my workflow greatly.

However, if I have multiple R sessions (even as few as 3), it can be difficult to remember which on is R, which is R:2, and which is R:3. Is there a way to get ESS, Emacs, or tramp to automatically name the different r sessions based on server / directory that R is running in?

Polyphemus answered 4/1, 2011 at 1:29 Comment(5)
Your previous answer was revised to mention uniquify - have you tried that?Tropo
@Nicholas yes I have tried uniquify, but the sessions are still named R, R:2, etc. not sure why, even after reading gnu.org/software/emacs/manual/html_node/emacs/Uniquify.htmlPolyphemus
@David it looks like there's an important distinction to be made between buffer names and process names. AFAIK, uniquify helps to clean up buffer names. When you run ess-switch-process, you're choosing from a list of processes, not buffers. Based on this answer it looks like you can't change the name of a process, so you're stuck. I'd love to be able to do exactly what you're asking, though!Flanker
@DanielKessler I have updated my answer. <kbd>C-c C-s</kbd> operates on buffer names and not on process names in recent versions of ESS.Urethroscope
@Urethroscope Excellent! Wish I could give you another up vote for th updateFlanker
U
6

[update]

New versions of ESS (> 12.09) operate on buffer names instead of internal process names. Now you can rename your inferior buffer with M-x rename-buffer and that will do the right thing. You can also configure ess-gen-proc-buffer-name-function to set up the automatic custom renaming of process buffers on startup.

[/update]

R, R:2 etk are the process names in ESS. I asked this question on ess mailing list an year or so ago. It seems like there is no straightforward way of changing this behavior. It's an emacs feature not ESS. You can change buffer names associated with the process but process names will be unchanged.

Uniquify changes buffer names as far I could see. And in any case in recent versions of emacs buffers with same file name are designated with partial paths to make them unique. So it looks like uniquify was adopted into base emacs for files, but not for other stuff like proc names.

Urethroscope answered 13/1, 2011 at 9:50 Comment(0)
B
2

Not sure about automatically renaming (and you could ask that on the ESS mailing list) but I sometimes use M-x rename-buffer which does just what it is supposed to do.

Breena answered 4/1, 2011 at 2:10 Comment(2)
I saw that, but I have not observed any effect of using uniquify in practice. From what I understand, uniquify should be the answer to my questionPolyphemus
I can't help you any more. For me, uniquify provides a more useful buffer as buffers with the same filenames gets a) disambiguated (foo.cpp<someDir>, foo.cpp<otherDir>) and b) searches get easier (greedy matches from buffer list).Breena

© 2022 - 2024 — McMap. All rights reserved.