Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using org-mode to maintain my programming notes. This means I have lots of source code blocks, as follows.

#+begin_src <language name>
    <code>
#+end_src

One thing I've noticed is that when I write the #+end_src, emacs doesn't color the source code as such. Yet, if I quit emacs and reopen the notes file (or force a refresh with the Org->Refresh/Reload->Refresh setup current buffer menu entry) the source is colored grey if I'm using the GUI or green if I'm using emacs in the terminal. Is this an inherent limitation of emacs, or am I doing something wrong in setting up my code blocks that's preventing emacs from going back and recoloring the source code that I've entered?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

I'm getting the same issue when testing and writing out the code by hand (however C-w C-y on the entire block does fontify it).

However if I use either yas-snippet (the snippets bundled with emacs24-starter-kit) and then expand src

#+begin_src <language>

#+end_src

or sb

#+source: <title>
#+begin_src <language>

#+end_src

or use the org built-in template expansion (See: Easy Templates) and <s for source code blocks the fontification works perfectly (although I do get org-mode fontification error echoed to my mini-buffer, so perhaps there is something that could be fixed). Once the fontification works it does seem that it will continue working.

It may be worth bringing up to the org-mode mailing list to see if any of the developers would have an answer as to whether this is by design or a bug.

share|improve this answer
    
Thanks for the C-w C-y suggestion. It's certainly easier than forcing org-mode to refresh the entire buffer. I also see that <s works, but in my case I don't see the fontification error. –  quanticle Nov 19 '11 at 20:52
    
The fontification error may be related to the theme I'm using. I'd have to test without it to see. (Although come to think of it I didn't see it today on my linux laptop, only on Windows when checking yesterday, so it might be OS related somehow. –  Jonathan Leech-Pepin Nov 19 '11 at 22:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.