[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

smart indentation for SQL files

From: Alex Harsanyi
Subject: smart indentation for SQL files
Date: Mon, 21 Dec 2015 19:42:18 +0800


About 10 years ago I had to edit many SQL files and the sql-mode that shipped
with GNU Emacs did not provide any smart indentation.  At the time, I wrote a
small indentation package, which I used for several months but never released

Shortly after, I changed jobs and didn't have to look at SQL files again until
recently. I noticed that the SQL indentation support is still missing from
Emacs and to my surprise my old code worked just fine.

I cleaned up the old code a bit, added suport for indenting WITH statements
and uploaded it to Github at:


The code is similar to cc-mode, in that it separates the "parsing" of the SQL
code from the indentation and the indentation rules can be modified by the
user to conform to local indentaiton guidelines or preferences.

I think this code would be a nice addition to sql.el.

Best Regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]