When I try to highlight SQL code in org-mode, the highlighting fails:
#+BEGIN_SRC SQL
SELECT *
FROM Production.Product
ORDER BY Name ASC;
#+END_SRC SQL
It works great for Python, shell etc, but not for SQL. I wonder if I am using the wrong keyword.
Given this:
To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores. MY PROJECT is the title of the document, this can be anything. This will enable Org mode for this document, no matter what the file-ending is.
Org Mode (also: org-mode; /ˈɔːrɡ moʊd/) is a document editing, formatting, and organizing mode, designed for notes, planning, and authoring within the free software text editor Emacs.
SQL
should be lowercase, sql
, and you don't need to repeat the language name on the END_SRC
line:
#+BEGIN_SRC sql
SELECT *
FROM Production.Product
ORDER BY Name ASC;
#+END_SRC
org-mode just appends -mode
to the language name given and tries to find a major mode function. Emacs Lisp function names are case sensitive, so sql-mode
exists while SQL-mode
doesn't.
You can get a list of all such functions by typing C-h a -mode$
, i.e. search for all functions that end with -mode
, but the resulting list contains many modes that are not major modes for programming languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With