emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to end a :session?


From: Andreas Leha
Subject: Re: [O] How to end a :session?
Date: Thu, 28 May 2015 11:31:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin)

Hi Rainer,

Rainer M Krug <address@hidden> writes:
> Christopher Witte <address@hidden> writes:
>
>> perhaps what you want is a named session, see
>> http://orgmode.org/manual/session.html
>
> Sure - that's what I have.
>
> But how can I close the named session when I don't need it anymore, or
> want to start, the next time I use the named session, with a new
> session?
>
>
>>
>> On 28 May 2015 at 10:44, Rainer M Krug <address@hidden> wrote:
>>
>>> Hi
>>>
>>> I can start a session as follow:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+begin_src R :session Test
>>> cat("Session Test\n")
>>> #+end_src
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Now I hava an R session named *Test*. But how can I closes this session?
>>> I thought about just quitting R
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+begin_src R :session Test
>>> q(save = "no)
>>> #+end_src
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> but this does not return as ESS is waiting for the prompt (">").
>>>
>>> Is there a way of closing the session *Test* and close the buffer?
>>>
>>> My reasoning is that I want to do different longer analysis in one org
>>> file and start each in its own session, i.e. clean R. But as they
>>> involve several steps, I don't want to put them into one code block.
>>>
>>> So I have several code blocks which I want to execute in a "throw away
>>> session" which I would like to discard afterwards.
>>>
>>> So I am looking for something like
>>>
>>> #+CLOSE_SESSION Test
>>>
>>> which would then close the session *Test*
>>>
>>> Is something like this possible at the moment?
>>>

How about

--8<---------------cut here---------------start------------->8---
#+name: killRsession
#+begin_src emacs-lisp :var rsession="*myR*" :results none
(progn
  (switch-to-buffer rsession)
  (ess-quit)
  (sleep-for 1)
  (kill-buffer))
#+end_src


#+call: killRsession("*myR*") :results none
--8<---------------cut here---------------end--------------->8---

Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]