[ESS] Automating launch of R session and splitting into 2buffers

Kevin Wright kw.statr at gmail.com
Mon Sep 8 23:48:43 CEST 2008

Here's one function for swapping.

;; Swap buffer windows
(defun swap-windows (arg)
  "Transpose the buffers shown in two windows."
  (interactive "p")
  (let ((selector (if (>= arg 0) 'next-window 'previous-window)))
    (while (/= arg 0)
      (let ((this-win (window-buffer))
            (next-win (window-buffer (funcall selector))))
        (set-window-buffer (selected-window) next-win)
        (set-window-buffer (funcall selector) this-win)
        (select-window (funcall selector)))
      (setq arg (if (plusp arg) (1- arg) (1+ arg))))))

;; And map it to a key
(define-key ctl-x-4-map (kbd "t") 'swap-windows)
(global-set-key "\C-xB" 'swap-windows)

Kevin Wright

On Mon, Sep 8, 2008 at 9:59 AM, Sebastian P. Luque <spluque at gmail.com> wrote:
> On Mon, 8 Sep 2008 09:09:52 -0400,
> gerald.jean at dgag.ca wrote:
> [...]
>> Thanks Sebastien, I have been wanting this behaviour for a long, very
>> long, time!  But, it seems there is always a but, it is possible to
>> have it the other way around, i.e. the S process (S+ in my case) in
>> the upper buffer?  I have been working that way for years, it is hard
>> to change!!!
> AFAICT, there's no built-in way to do that, but I remember someone
> posted a function in emacswiki.org to swap buffers between windows.  If
> you find it (sorry, I don't have it with me), you can add it to
> inferior-ess-mode-hook (with nil inferior-ess-same-window).
> --
> Seb
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

More information about the ESS-help mailing list