emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Automatically insert R source code block?
@ 2011-09-15 23:18 Michael Hannon
  2011-09-15 23:58 ` suvayu ali
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Hannon @ 2011-09-15 23:18 UTC (permalink / raw)
  To: Org-Mode List

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatically insert R source code block?
  2011-09-15 23:18 Automatically insert R source code block? Michael Hannon
@ 2011-09-15 23:58 ` suvayu ali
  2011-09-16  0:22   ` Michael Hannon
  0 siblings, 1 reply; 4+ messages in thread
From: suvayu ali @ 2011-09-15 23:58 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Org-Mode List

Hey Mike,

On Fri, Sep 16, 2011 at 1:18 AM, Michael Hannon <jm_hannon@yahoo.com> wrote:
> 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.
>

Do you have org-src-fontify-natively set to t? If so I am taking a
shot in the dark here, emacs probably doesn't know how to fontify R
source. Do you have emacs-ess installed? I would expect an error like
this if its not.

But I could be wrong here as I don't use either of emacs-ess or R.

Hopefully this was of some help.

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatically insert R source code block?
  2011-09-15 23:58 ` suvayu ali
@ 2011-09-16  0:22   ` Michael Hannon
  2011-09-16  8:49     ` Rainer M Krug
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Hannon @ 2011-09-16  0:22 UTC (permalink / raw)
  To: suvayu ali; +Cc: Org-Mode List

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

> From: suvayu ali <fatkasuvayu+linux@gmail.com>
> 
> Hey Mike,
> 
> On Fri, Sep 16, 2011 at 1:18 AM, Michael Hannon <jm_hannon@yahoo.com> wrote:
>> 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.
>>
>
> Do you have org-src-fontify-natively set to t? If so I am taking a
> shot in the dark here, emacs probably doesn't know how to fontify R
> source. Do you have emacs-ess installed? I would expect an error like
> this if its not.
> 
> But I could be wrong here as I don't use either of emacs-ess or R.

Hi, Suvayu.  The variable org-src-fontify-natively was set to nil, but I get
the same result with it set to 't'.

I do have Emacs-ess installed.

I've been assuming that I was just messing up the syntax, but maybe there's
something deeper involved.

Thanks for your note.

-- Mike

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatically insert R source code block?
  2011-09-16  0:22   ` Michael Hannon
@ 2011-09-16  8:49     ` Rainer M Krug
  0 siblings, 0 replies; 4+ messages in thread
From: Rainer M Krug @ 2011-09-16  8:49 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Org-Mode List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16/09/11 02:22, Michael Hannon wrote:
>> From: suvayu ali <fatkasuvayu+linux@gmail.com>
>> 
>> Hey Mike,
>> 
>> On Fri, Sep 16, 2011 at 1:18 AM, Michael Hannon
>> <jm_hannon@yahoo.com>
> wrote:
>>> 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.
>>> 
>> 
>> Do you have org-src-fontify-natively set to t? If so I am taking
>> a shot in the dark here, emacs probably doesn't know how to
>> fontify R source. Do you have emacs-ess installed? I would expect
>> an error like this if its not.
>> 
>> But I could be wrong here as I don't use either of emacs-ess or
>> R.
> 
> Hi, Suvayu.  The variable org-src-fontify-natively was set to nil,
> but I get the same result with it set to 't'.
> 
> I do have Emacs-ess installed.
> 
> I've been assuming that I was just messing up the syntax, but maybe
> there's something deeper involved.
> 
> Thanks for your note.

Don't worry - try to insert the <s template and observe - the error is
also there (at least most of the time).
But as soon as I go into the code block, everything is fine - so I
would not worry to much, but to hope that this will be fixed?

org version:
Org-mode version 7.7 (release_7.7.285.ge73b)
and
Org-mode version 7.7 (release_7.7.291.g37db)

Rainer
> 
> -- Mike
> 
> 
> 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5zDYIACgkQoYgNqgF2egr3cACdG2UdRP9ykebSD6f746C3h3CQ
uv4AnA+8KjVna9H5jkllrvM1L9GM0tlK
=nnRu
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-16  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15 23:18 Automatically insert R source code block? Michael Hannon
2011-09-15 23:58 ` suvayu ali
2011-09-16  0:22   ` Michael Hannon
2011-09-16  8:49     ` Rainer M Krug

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).