From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: How to end a :session? Date: Thu, 28 May 2015 13:02:23 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwWM-0001hB-HW for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwWI-0000mt-Qb for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:02:46 -0400 Received: from plane.gmane.org ([80.91.229.3]:54931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwWI-0000mj-Kl for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:02:42 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YxwWE-00078y-PG for emacs-orgmode@gnu.org; Thu, 28 May 2015 14:02:38 +0200 Received: from 193.63.221.33 ([193.63.221.33]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 May 2015 14:02:38 +0200 Received: from andreas.leha by 193.63.221.33 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 May 2015 14:02:38 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Rainer M Krug writes: > Andreas Leha writes: > >> Hi Rainer, >> >> Rainer M Krug writes: >>> Andreas Leha writes: >>> >>>> Hi Rainer, >>> >>> Hi Andreas, >>> >>>> >>>> Rainer M Krug writes: >>>>> Christopher Witte 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 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 >>>> >>>> #+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 >>> >>> Thanks - this works. But I get an error which says: >>> >>> ,---- >>> | save-excursion: Wrong type argument: integer-or-marker-p, nil >>> `---- >>> >>> Any suggestion on how to avoid this? >>> >> >> I do not see that error, so hard to say. Do you have a backtrace? Wild >> guess: Maybe the ess-quit changed? What version of ess are you using? > > ess-15.03 > I am on ess-15.09-devel. >> >> Note, that this could be improved by replacing the (sleep-for 1) with >> something that actually waits until R has quit... > > I can live with the error for now, but I might look into it some time > later. > Fine. Andreas