From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: [ANN] New babel features: sessions, ESS & remote commands Date: Tue, 17 Aug 2010 18:10:14 -0400 Message-ID: <878w44vqk9.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=41209 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlUMN-00087S-6g for emacs-orgmode@gnu.org; Tue, 17 Aug 2010 18:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OlUMM-00067t-3c for emacs-orgmode@gnu.org; Tue, 17 Aug 2010 18:10:19 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:45235) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlUML-00067j-SN for emacs-orgmode@gnu.org; Tue, 17 Aug 2010 18:10:18 -0400 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o7HMAGZj013522 for ; Tue, 17 Aug 2010 23:10:16 +0100 (BST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs org-mode mailing list I've just pushed the additions below to the master branch. The first two are intended to improve working with sessions in general and ESS (R) in particular. The second two allow 'remote commands': babel commands in code buffers, and language major mode commands from Org buffers. 1 New command to split frame between code and session ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New function `org-babel-switch-to-session-with-code' splits the frame between the code buffer and the session, leaving point in the code buffer. This is bound to C-c C-v z (Note that the related command `org-babel-switch-to-session' has a similar binding: C-c C-v C-z.) ESS (R) users, for example, can use this command and then proceed to send code to the session with `ess-eval-function-or-paragraph-and-step' (C-c C-c) or other ess-eval-* functions. 2 Better integration between code buffer and ESS (R) sessions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If :session is in effect[1] and the session is running, C-c ' now explicitly tries to associate the code buffer with the session (currently implemented for R). This means that when language major-mode commands are used to send code to the session for evaluation, they should always know which session to send the code to. 3 Org-babel commands are available in code buffers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `org-src-do-key-sequence-at-code-block' in the *code buffer* can be used to execute a babel command (e.g. tangle or execute) without having to return to the Org buffer. In order to avoid stealing major mode bindings, this is not bound by default. It makes sense to set the key binding in the `org-src-mode-hook'. For example, to use C-c @ for this command in all language mode buffers, you could use (add-hook 'org-src-mode-hook (lambda () (define-key org-src-mode-map "\C-c@" 'org-src-do-key-sequence-at-code-block))) 4 Language major mode commands are available at Org code blocks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `org-babel-do-key-sequence-in-edit-buffer' in the *Org buffer* will prompt for a key sequence, which is executed in the language major mode edit buffer. This is bound to C-c C-v C-x and C-c C-v x. Possible uses include C-c C-v C-x TAB: Perform language-specific TAB behaviour For ESS (R) users: C-c C-v C-x C-c C-c: `ess-eval-function-or-paragraph-and-step' without manually visiting the ess-mode buffer. [1] ':session in effect' means :session is turned on for current block. This may be as a result of a header arg, a subtree property, a #+babel: buffer option or configuration of `org-babel-default-header-args' or `org-babel-default-header-args:LANG'. Dan