aartist
aartist

Reputation: 3236

Different modes within org-mode

How to define the mode at the headline level? I like to have data stored in my org-mode file and define the mode at headline-level rather than file-level. So I like to have

* SQL Query (This should be in SQL-Mode)
Select * from sometable where some condition
* A Java Program ( This should be in Java-Mode)
public static void string..

Upvotes: 0

Views: 84

Answers (1)

legoscia
legoscia

Reputation: 41558

You can use source blocks. Something like:

* SQL Query (This should be in SQL-Mode)
#+BEGIN_SRC sql
Select * from sometable where some condition
#+END_SRC

* A Java Program ( This should be in Java-Mode)
#+BEGIN_SRC java
public static void string..
#+END_SRC

It's not quite as seamless as what you're asking for, but you can open the source block with C-c ' and edit the code in a buffer with the right major mode.

Upvotes: 4

Related Questions