Automating launch of R session and splitting into 2 buffers

View: New views
8 Messages — Rating Filter:   Alert me  

Automating launch of R session and splitting into 2 buffers

by Frank E Harrell Jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am looking for a good way to specify something in .emacs for Emacs
such that when I have a .r source file opened, hitting Esc R will split
the window into two buffers and start the R process in the lower buffer.
I find myself always doing Cntl-X-2 and then having to put foo.r back
into the upper buffer.

Tony Rossini outlined the following:

(defun myR ()
   (interactive)
   (if (= (major-mode 'current-buffer) 'R-mode)
            (split-window))
   (R)
   (put-cursor-other-window))

which would be invoked with M-x myR.  If anyone knows how to complete
that code including the spellings of the correct function calls, or has
another idea I'd appreciate hearing about it.  I have already put (setq
ess-ask-for-ess-directory nil) in my .emacs to bypass the selection of
the working directory.

Thanks
Frank

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2 buffers

by Sebastian P. Luque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 07 Sep 2008 11:06:09 -0500,
Frank E Harrell Jr <f.harrell@...> wrote:

> I am looking for a good way to specify something in .emacs for Emacs
> such that when I have a .r source file opened, hitting Esc R will
> split the window into two buffers and start the R process in the lower
> buffer.  I find myself always doing Cntl-X-2 and then having to put
> foo.r back into the upper buffer.

[...]

If I'm following you, I think all you need is to set
inferior-ess-same-window to nil.  Does that do what you want?


Cheers,

--
Seb

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2 buffers

by Frank E Harrell Jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sebastian P. Luque wrote:

> On Sun, 07 Sep 2008 11:06:09 -0500,
> Frank E Harrell Jr <f.harrell@...> wrote:
>
>> I am looking for a good way to specify something in .emacs for Emacs
>> such that when I have a .r source file opened, hitting Esc R will
>> split the window into two buffers and start the R process in the lower
>> buffer.  I find myself always doing Cntl-X-2 and then having to put
>> foo.r back into the upper buffer.
>
> [...]
>
> If I'm following you, I think all you need is to set
> inferior-ess-same-window to nil.  Does that do what you want?
>
>
> Cheers,
>
 > Seb

Thanks that worked beautifully!

Is there a way to have help files automatically opened in a new frame
when I issue ?functionname in the R session window (and hopefully to
keep using that frame for later instances of ?functionname)?

Thanks Sebastian,
Frank

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2 buffers

by Sebastian P. Luque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 07 Sep 2008 11:47:06 -0500,
Frank E Harrell Jr <f.harrell@...> wrote:

[...]

> Is there a way to have help files automatically opened in a new frame
> when I issue ?functionname in the R session window (and hopefully to
> keep using that frame for later instances of ?functionname)?

C-h v ess-help-own-frame


--
Seb

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2 buffers

by Frank E Harrell Jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sebastian P. Luque wrote:

> On Sun, 07 Sep 2008 11:47:06 -0500,
> Frank E Harrell Jr <f.harrell@...> wrote:
>
> [...]
>
>> Is there a way to have help files automatically opened in a new frame
>> when I issue ?functionname in the R session window (and hopefully to
>> keep using that frame for later instances of ?functionname)?
>
> C-h v ess-help-own-frame
>
>

Perfect.  Thank you very much Sebastian, for both valuable pointers.
Frank

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2buffers

by gerald.jean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



ess-help-bounces@... a écrit sur 2008/09/07 12:32:44 :

> On Sun, 07 Sep 2008 11:06:09 -0500,
> Frank E Harrell Jr <f.harrell@...> wrote:
>
> > I am looking for a good way to specify something in .emacs for Emacs
> > such that when I have a .r source file opened, hitting Esc R will
> > split the window into two buffers and start the R process in the lower
> > buffer.  I find myself always doing Cntl-X-2 and then having to put
> > foo.r back into the upper buffer.
>
> [...]
>
> If I'm following you, I think all you need is to set
> inferior-ess-same-window to nil.  Does that do what you want?
>
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!!!

Thanks,

Gérald Jean
Conseiller senior en statistiques,
VP Planification et Développement des Marchés,
Desjardins Groupe d'Assurances Générales
télephone            : (418) 835-4900 poste (7639)
télecopieur          : (418) 835-6657
courrier électronique: gerald.jean@...

"In God we trust, all others must bring data"  W. Edwards Deming
>
> Cheers,
>
> --
> Seb
>
> ______________________________________________
> ESS-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help




Faites bonne impression et imprimez seulement au besoin !
Think green before you print !

Le message ci-dessus, ainsi que les documents l'accompagnant, sont destinés uniquement aux personnes identifiées et peuvent contenir des informations privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce message par erreur, veuillez le détruire.

This communication (and/or the attachments) is intended for named recipients only and may contain privileged or confidential information which is not to be disclosed. If you received this communication by mistake please destroy all copies.

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2buffers

by Sebastian P. Luque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 8 Sep 2008 09:09:52 -0400,
gerald.jean@... 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@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Automating launch of R session and splitting into 2buffers

by Kevin Wright-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> wrote:

> On Mon, 8 Sep 2008 09:09:52 -0400,
> gerald.jean@... 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@... mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help
LightInTheBox - Buy quality products at wholesale price!