Set the other windows to R process

Sometimes when writing R code on an ess buffer I need to use a different R process. This is accomplished by using the ess-switch-process function. The problem is that I would like to also change the other-window to this new R session automatically as soon as I make the switch.

The following code accomplish this:

(defun set-other-to-ess-process()
  "set the other window to the R process associated to ess buffer"
       (cprocess ess-local-process-name)
      (message "Associated buffer is %s" cprocess)
      (set-other-window-func (process-buffer (get-process cprocess)))

(advice-add 'ess-switch-process :after #'set-other-to-ess-process)
Fred Gruber
Fred Gruber
Senior Principal Scientist

My research interests include causal inference, Bayesian networks, causal discovery, machine learning.