From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikhail Titov Subject: Re: [babel, ess] How can I make S-RET to be multi-session friendly? Date: Fri, 10 Aug 2012 13:54:04 -0500 Message-ID: <9q0sjbuvar7.fsf@gmx.us> References: <9q01ujfoqh2.fsf@gmx.us> <87boiidil2.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szuao-0004rS-ET for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 15:09:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szuan-00074N-0h for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 15:09:54 -0400 Received: from mailout-us.gmx.com ([74.208.5.67]:35001 helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Szuam-00073F-RN for emacs-orgmode@gnu.org; Fri, 10 Aug 2012 15:09:52 -0400 In-Reply-To: <87boiidil2.fsf@gmx.com> (Eric Schulte's message of "Fri, 10 Aug 2012 06:42:17 -0600") 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: Eric Schulte Cc: emacs-orgmode@gnu.org Eric Schulte writes: >> There is a wonderful post[1] on how to make S-RET to do handy things in >> ESS mode. However I often find myself working on several Org documents >> from different folders. >> >> It is quite inconvenient to change a directory in =*R*= buffer each >> time I work on different document. >> >> Is there a neat way to somehow reuse Org mode property =session= that I >> set buffer wide? >> > > I'm not sure what you mean by "reuse". All of the information for how > to set header arguments in available at (info "(org) Using header > arguments") Here is the outline of what I have and what I'm doing. As I mentioned I set default :session header for R to *R*. In my file I have something like #+PROPERTY: session *Rreport* Whenever I C-c C-c on code block, I can see that *R* buffer was created instead of *Rreport* ! Now, if I edit my code block with C-c ' and hit S-RET on any line, it evaluates in *R* whereas I'd prefer it to be *Rreport* somehow. I understand that I'm trying to somewhat mix ob with plain ESS. Nevertheless I wonder if it is somehow possible. >> Also for some reason >> >> #+PROPERTY: session *Rsomename* >> >> does not override session name set in >> =org-babel-default-header-args:R= even after =C-c C-c= on it when I >> re-evaluate babel code block with =C-c C-c= on code block, while >> explicit block header =:session *Rsomename*= makes difference. >> > > Yes, the order of precedence is > > system-level < buffer/subtree-level < language-level < > code-block-level Then I'd say buffer level does NOT override system-level for some reason. I just re-built Emacs from bzr to make sure I'm running somewhat recent Org. Another weird thing is that when I tried to use Org from git (and not the stock one), Emacs freezes deadly on (org-clock-persistence-insinuate) unless I kill ntvdm.exe with Task Manager (I'm on Windows). But I guess it is a separate story. >> ,----[ snippet from dot emacs ] >> | (setq org-babel-default-header-args:R >> | '((:results . "output") (:session . "*R*"))) >> `---- >> > > Given that (:session . "*R*") will be used by default you could simply > remove it from your custom setting for org-babel-default-header-args. This made a trick. Now indeed I have *Rreport* after C-c C-c on code block. However after C-c ' whenever I attempt to S-RET, yet another *R* is launched every time instead of evaluating a line. So the question perhaps is: How to alter [1] such that when I edit code block with C-c ' , S-RET executes lines in a proper session. I believe all information is in there, I just have no clue how would I extract it, e.g. to which main buffer that code editing buffer (I don't know the right name for it) belongs to, and what session header is set to in that buffer. If there is a way to fetch those, perhaps I'd be able to alter original set up in [1]. >> Footnotes: >> [1] >> http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/ -- Mikhail