From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: Error Embedding SQL Source from code block into R Source of Another (noweb) Date: Tue, 30 Sep 2014 15:08:36 +0000 (UTC) Message-ID: References: <87lhp2x7p9.fsf@air.ben-zion.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYz31-0004k7-5h for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 11:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYz2t-00058C-G8 for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 11:09:02 -0400 Received: from plane.gmane.org ([80.91.229.3]:59894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYz2t-00057g-79 for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 11:08:55 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XYz2k-00014y-G2 for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 17:08:46 +0200 Received: from 137.110.34.228 ([137.110.34.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Sep 2014 17:08:46 +0200 Received: from ccberry by 137.110.34.228 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Sep 2014 17:08:46 +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 Eric Brown fastmail.fm> writes: > > Dear List: > > It is possible to embed SQL code as a string to be evaluated in R. I am > interested in formatting the SQL code in its own source code block, with > its own syntax highlighting and editing mode (C-c '). > > The first time I run the code, I am prompted for R starting directory, > but I get an error: > > --- > load ESSR: + + + Error: unexpected string constant in: > source('~/.emacs.d/elpa/ess-20140913.1153/etc/ESSR/R/.load.R', > local=TRUE) #define load.ESSR > load.ESSR('" > --- > > and the console locks. I can C-g to get out of it, and then > re-evaluate, and the code prints what I expect -- the text of the SQL > command. [rest deleted] Hmmm. Maybe the bug that was fixed by commit 0fd29a5ee7d14c3695b22998196373b9a3637413 about two weeks back? Make sure ob-R.el is up to date and compiled (or that ob-R.elc is deleted). Anyway, your code works as expected for me - first time. --- FWIW, I prefer to use :var headers to import strings, but it takes some setup: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC emacs-lisp (defun grab-src (name) (save-excursion (org-babel-goto-named-src-block name) (nth 1 (org-babel-get-src-block-info 'light)))) #+END_SRC #+BEGIN_SRC R :var y=(grab-src "sqlsource") :results output :exports both y #+END_SRC #+RESULTS: : [1] "select \n * \nfrom \n t \nlimit \n 10" --8<---------------cut here---------------end--------------->8--- HTH, Chuck