From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hannon Subject: Automatically insert R source code block? Date: Thu, 15 Sep 2011 16:18:39 -0700 (PDT) Message-ID: <1316128719.82446.YahooMailNeo@web161917.mail.bf1.yahoo.com> Reply-To: Michael Hannon Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0-928818530-1316128719=:82446" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4LCc-0000gT-LO for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 19:18:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4LCb-0004Mn-9m for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 19:18:42 -0400 Received: from nm38-vm7.bullet.mail.bf1.yahoo.com ([72.30.239.23]:39677) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1R4LCb-0004Lt-6l for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 19:18:41 -0400 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: Org-Mode List --0-928818530-1316128719=:82446 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Greetings.=A0 Pardon my ignorance, but I'm having trouble understanding som= e elisp syntax.=0A=0ASome time ago I asked on this list how to use the "<..= ." shortcut to insert a source-code block in upper case (as: BEGIN_SRC= , etc.),=0A=0ASuvayu Ali responded with:=0A=0A=0A(add-to-list 'org-structur= e-template-alist=0A=A0=A0=A0=A0=A0=A0=A0 '("S" "#+BEGIN_SRC ?\n\n#+END_SRC"= "\n\n"))=0A=0A=0Aand this indeed worked just fine = (thanks, Suvayu!).=0A=0A=0ALately most of the source blocks I've been using= have been R source blocks, so I thought I'd just modify the elisp above to= stick the string " R" after the "begin_src" string.=0A=0AHere's an example= of something I tried:=0A=0A=0A(add-to-list 'org-structure-template-alist= =0A=A0=A0=A0=A0=A0=A0=A0 '("r" "#+begin_src R\n\n#+end_src" "\n\n"))=0A=0AThe first part of this works OK; i.e., I do get:=0A= =0A=A0=A0=A0 #+begin_src R=0A=0A=A0=A0=A0 #+end_src=0A=0Abut Emacs complain= s about an "org-mode fontification error" and doesn't give me an executable= R source-code block.=A0 I've tried numerous minor variations on this theme= , but I don't think it's worth wasting your time by listing all of the thra= shing I've done.=A0 The solution is probably obvious to people with a decen= t understanding of elisp.=0A=0A=0AIf you have any suggestions, please send = them to me.=A0 Thanks.=0A=0A-- Mike=0A --0-928818530-1316128719=:82446 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Greetings.  Pardon my ig= norance, but I'm having trouble understanding some elisp syntax.
=
Some time ago I asked on this list how to use the "<...&l= t;TAB>" shortcut to insert a source-code block in upper case (as: BEGIN_= SRC, etc.),

Suvayu Ali responded with:

(add-to-list 'org-structure-template-alist
   &nbs= p;    '("S" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src lang=3D\"?= \">\n\n</src>"))

and this indeed work= ed just fine (thanks, Suvayu!).

Lately most of= the source blocks I've been using have been R source blocks, so I thought = I'd just modify the elisp above to stick the string " R" after the "begin_s= rc" string.

Here's an example of something I tried:

(add-to-list 'org-structure-template-a= list
        '("r" "#+begin_src R\n\n= #+end_src" "<src lang=3D\"R\">\n\n</src>"))

The first pa= rt of this works OK; i.e., I do get:

  &= nbsp; #+begin_src R

    #+end_src

but Emacs complains about an "org-mode fontificatio= n error" and doesn't give me an executable R source-code block.  I've = tried numerous minor variations on this theme, but I don't think it's worth= wasting your time by listing all of the thrashing I've done.  The sol= ution is probably obvious to people with a decent understanding of elisp.

If you have any suggestions, please send them t= o me.  Thanks.

-- Mike
= --0-928818530-1316128719=:82446--