2

I have this in my init.el to enable block code syntax highlighting in org-mode:

(setq org-src-fontify-natively t)

I have also this for org-babel:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (ditaa . t)))

when I insert source code < s followed by TAB to draw something using ditaa (same problem with emacs-lisp code, it seems to be a general SRC code block problem), the syntax highlighting breaks when I write this line:

#+BEGIN_SRC ditaa :file "./foo.png" :cmdline -r

No syntax highlighting but code can be evaluated

enter image description here

However, when I leave only #+BEGIN_SRC sitting alone in the first line I get the highlighting right, but code will not be evaluated in this case when I hit C-c C-c. Even one space after SRC is enough to break that syntax highlighting. What is going on? Can anyone help me fix it?

Syntax highlighting is right but code cannot be evaluated

enter image description here

Note

  • GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian)
  • GNU Emacs 25.1.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-09-29; nothing changed.
  • Org mode version 9.0.4 (release_9.0.4-248-gdef8a8)
  • Org mode version 9.0.5 (release_9.0.5-288-g4caad0) problem presists
  • theme used is moe-dark

Update

When I run emacs --vanilla from the terminal, the problem disappears. So what is going on? What to do next to find the cause from here?

3
  • I can't reproduce this with Emacs 25.1.91.1, so upgrading might help if possible
    – Tyler
    Commented Feb 17, 2017 at 19:16
  • same problem after upgrading to emacs 25.1.2
    – doctorate
    Commented Feb 18, 2017 at 9:00
  • I am experiencing a similar issue in org-mode v 9.3.8. I don't have anything similar to your polymode package though...
    – Ajned
    Commented Sep 12, 2020 at 8:36

1 Answer 1

0

By commenting out this line in my init.el problem was removed, the line was related to polymode package.

(add-to-list 'auto-mode-alist '("\\.org" . poly-org-mode))

That's it. This post was very helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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