From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: How to end a :session? Date: Thu, 28 May 2015 14:08:47 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwcK-0007zD-Cl for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:09:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwcG-0002iy-Ow for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:08:56 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwcG-0002ip-Gw for emacs-orgmode@gnu.org; Thu, 28 May 2015 08:08:52 -0400 Received: by wifw1 with SMTP id w1so59356098wif.0 for ; Thu, 28 May 2015 05:08:52 -0700 (PDT) In-Reply-To: (Andreas Leha's message of "Thu, 28 May 2015 13:02:23 +0100") 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: Andreas Leha Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Andreas Leha writes: > 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 se= ssion? >>>>>>>> I thought about just quitting R >>>>>>>> >>>>>>>> --8<---------------cut here---------------start------------->8--- >>>>>>>> #+begin_src R :session Test >>>>>>>> q(save =3D "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 bloc= k. >>>>>>>> >>>>>>>> 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=3D"*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. That might explain. For some time, I was using the git version (and I still update it daily) but I was quite a few times bitten by changes / bugs so I decided to use the latest stable release of ESS. > >>> >>> 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 > > =2D-=20 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,= UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJVZwVPAAoJENvXNx4PUvmChR4H/0uBv5QNADFtNhV165K19put E/CigY1oR7ltoXHOvSrc7jfLmjGl8TLZuoQ4mBRH2qGIxaeYy+akdRTCekeRDtY2 dwNYOHPhasVpc/fpjw+UBhBUwm+gku+SneIHd24Xyr1Des8yUDfx//+jz9U9bodh MiZZUzwVWpSq85MXbw1qcApbHfN/a0jJknKdk/dHiR9SajdX8FOevX6IT8WbJ4bd pXLZoZhlRSGP0KOsg8POLgFNeZOooKnRGXjWOWi1bHbutSEmgqP7KqREEgDmpXLw 6ux0ahG+VoYoLrHdCI/TdDvbt4OfpeWjg0ANNXvsFpCwseBZLYzrHTsSXeVaM+4= =YXrY -----END PGP SIGNATURE----- --=-=-=--