I want to manage my library of snippets from a single org-mode document and tangle these to their respective snippet files, as needed. Now functionally, this works out-of-the box, with the one exception: org-babel does not know how to font-lock a snippet and I cannot find an ob-snippet.el file anywhere on the web.

Now Yasnippet does has a snippet major mode that it uses to font-locks snippets, when viewed from their own buffer. How can I get org-babel to use this to fontify snippets from within a babel code block?

To better illustrate, here is a screenshot of my article snippet from within org-mode

enter image description here and here it is, nice and fontified under the snippet major mode:

enter image description here Any ideas?

  • Please don't use images for code: you make life difficult for potential answerers.
    – NickD
    May 8, 2020 at 20:50

1 Answer 1


Your source code block has text set as the mode. Try changing that to read

#+BEGIN_SRC snippet :tangle ~/org/snippets/bibtex-mode/article

enter image description here

  • 1
    That did it. Thanks @gregoryg!
    – Adam
    May 10, 2020 at 4:02

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.