emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Hannon <jm_hannon@yahoo.com>
To: Org-Mode List <emacs-orgmode@gnu.org>
Subject: Automatically insert R source code block?
Date: Thu, 15 Sep 2011 16:18:39 -0700 (PDT)	[thread overview]
Message-ID: <1316128719.82446.YahooMailNeo@web161917.mail.bf1.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1879 bytes --]

             reply	other threads:[~2011-09-15 23:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 23:18 Michael Hannon [this message]
2011-09-15 23:58 ` Automatically insert R source code block? suvayu ali
2011-09-16  0:22   ` Michael Hannon
2011-09-16  8:49     ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316128719.82446.YahooMailNeo@web161917.mail.bf1.yahoo.com \
    --to=jm_hannon@yahoo.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).