From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [org-babel] Using the power of ESS inside an R source code block Date: Tue, 26 Oct 2010 15:05:08 +0100 Message-ID: <87tyk9f3sb.fsf@gmail.com> References: <4CC40000.3090508@uni-koeln.de> <4CC40673.6030403@uni-koeln.de> <87r5feuz0y.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=58713 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PAk9L-0000Pc-9F for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 10:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PAk9J-0000cL-NK for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 10:05:14 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:49809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PAk9J-0000ba-GQ for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 10:05:13 -0400 In-Reply-To: <87r5feuz0y.fsf@gmail.com> (Eric Schulte's message of "Mon, 25 Oct 2010 08:29:01 -0600") 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: Eric Schulte Cc: Bernd Weiss , emacs-orgmode@gnu.org "Eric Schulte" writes: > Hi Bernd, > > It seems that you have already found the best solution in the indirect > edit buffers (by calling C-c ' from inside of a code block). I would > only add that in the email you mentioned below, I was specifically > talking about syntax highlighting of R code in Org-mode buffers, which > at the time I believed was not possible. It would seem I was wrong, as > such syntax highlighting is now implemented in recent versions of > Org-mode through setting the `org-src-fontify-natively' variable. > > Hope you enjoy using Org-mode with Ess. > > Best -- Eric > > Bernd Weiss writes: > >> Am 24.10.2010 05:44, schrieb Bernd Weiss: Hi Bernd, >>> Dear all, >>> >>> Yesterday, I spent some time (re-)discovering the power of org-babel >>> and R. Everything works well but there is one issue that I find >>> somewhat annoying (I apologise if this word is too rude). Not at all. Good to know what drawbacks users are encountering. I'm happy to report that all three of the things you mention are now possible in the Org buffer. You will need to be using a recent version of Org-mode (i.e. from within the last few weeks). >>> As a >>> long-time ESS user I wish that I could use things like ESS syntax >>> highlighting, This, as Eric mentioned, is turned on with `org-src-fontify-natively'. However from your config below it seems you have set this variable. So that requires some explanation -- please let us know if syntax highlighting in the Org buffer is working for you or not. >>> indentation Setting `org-src-tab-acts-natively' causes TAB to have the indenting effect that you would get in an ESS buffer.[2] Beyond these two variables, there is a general method that addresses the issues you are raising. It involves using the function `org-babel-do-key-sequence-in-edit-buffer'. For example, here is how to make C-M-\ perform language-specific indentation on the active region in the source block: (defun dan/org-indent-region () (interactive) (or (org-babel-do-key-sequence-in-edit-buffer "\C-\M-\\") (indent-region))) (define-key org-mode-map "\C-\M-\\" 'dan/org-indent-region) >>> or some keybindings (e.g. for "<-") inside >>> an R source code block. This one can be done with (defun dan/org-underscore-command () (interactive) (or (org-babel-do-key-sequence-in-edit-buffer "_") (org-self-insert-command 1))) (define-key org-mode-map "_" 'dan/org-underscore-command) And another one that you may like is for commenting code: (defun dan/org-comment-dwim (&optional arg) (interactive "P") (or (org-babel-do-key-sequence-in-edit-buffer "\M-;") (comment-dwim arg))) (define-key org-mode-map "\M-;" 'dan/org-comment-dwim) I hope the above supplies the missing functionality. Dan >>> However, with respect to an e-mail from Eric >>> Schulte >>> >>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg22301.html >>> >>> (or this one: >>> https://stat.ethz.ch/pipermail/ess-help/2009-September/005544.html ) >>> >>> this seems to be a feature wich is hard to realise inside org-babel. >>> Is this (still) correct? Or is it a problem with my >>> installation/initialisation of org-mode/org-babel?[1] >> >> >> Ok, one workaround are indirect buffers, right? This blog post is >> really helpful (see "A note about syntax highlighting in Emacs") >> >> http://blogisticreflections.wordpress.com/2010/05/23/introduction-to-using-r-with-org-babel-part-1/ >> >> Bernd >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode