emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Automatically insert R source code block?


From: Michael Hannon
Subject: [O] Automatically insert R source code block?
Date: Thu, 15 Sep 2011 16:18:39 -0700 (PDT)

Greetings.  Pardon my ignorance, but I'm having trouble understanding some elisp syntax.

Some time ago I asked on this list how to use the "<...<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
        '("S" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src lang=\"?\">\n\n</src>"))

and this indeed worked 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_src" string.

Here's an example of something I tried:

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

The first part of this works OK; i.e., I do get:

    #+begin_src R

    #+end_src

but Emacs complains about an "org-mode fontification 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 solution is probably obvious to people with a decent understanding of elisp.

If you have any suggestions, please send them to me.  Thanks.

-- Mike

reply via email to

[Prev in Thread] Current Thread [Next in Thread]