Mercurial > urweb
diff src/elisp/urweb-mode.el @ 372:fe018cbdd41e
Indenting SELECT sub-clauses properly
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Oct 2008 16:15:17 -0400 |
parents | 782ef3ad8c28 |
children | 008afab3a5ce |
line wrap: on
line diff
--- a/src/elisp/urweb-mode.el Thu Oct 16 16:00:58 2008 -0400 +++ b/src/elisp/urweb-mode.el Thu Oct 16 16:15:17 2008 -0400 @@ -512,6 +512,12 @@ (beginning-of-line) (current-indentation))) +(defconst urweb-sql-starters + '("FROM" "WHERE" "GROUP" "ORDER" "HAVING" "LIMIT" "OFFSET")) + +(defconst urweb-sql-starters-re + (urweb-syms-re urweb-sql-starters)) + (defun urweb-calculate-indentation () (save-excursion (beginning-of-line) (skip-chars-forward "\t ") @@ -566,6 +572,11 @@ (urweb-indent-default 'noindent) (current-column)))) + (and (looking-at urweb-sql-starters-re) + (save-excursion + (and (re-search-backward urweb-sql-starters-re nil t) + (current-indentation)))) + (and (setq data (assoc sym urweb-close-paren)) (urweb-indent-relative sym data))