diff src/elisp/urweb-mode.el @ 373:008afab3a5ce

Indenting simple DML properly
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Oct 2008 16:24:19 -0400
parents fe018cbdd41e
children 1099d083a702
line wrap: on
line diff
--- a/src/elisp/urweb-mode.el	Thu Oct 16 16:15:17 2008 -0400
+++ b/src/elisp/urweb-mode.el	Thu Oct 16 16:24:19 2008 -0400
@@ -512,9 +512,16 @@
     (beginning-of-line)
     (current-indentation)))
 
+(defconst urweb-sql-main-starters
+  '("SELECT" "INSERT" "UPDATE" "DELETE"))
+
 (defconst urweb-sql-starters
-  '("FROM" "WHERE" "GROUP" "ORDER" "HAVING" "LIMIT" "OFFSET"))
+  (append urweb-sql-main-starters
+          '("^\\s-+FROM" "WHERE" "GROUP" "ORDER" "HAVING" "LIMIT" "OFFSET"
+            "VALUES" "SET")))
 
+(defconst urweb-sql-main-starters-re
+  (urweb-syms-re urweb-sql-main-starters))
 (defconst urweb-sql-starters-re
   (urweb-syms-re urweb-sql-starters))
 
@@ -575,7 +582,9 @@
         (and (looking-at urweb-sql-starters-re)
              (save-excursion
                (and (re-search-backward urweb-sql-starters-re nil t)
-                    (current-indentation))))
+                    (if (looking-at urweb-sql-main-starters-re)
+                        (current-column)
+                      (current-indentation)))))
 
 	(and (setq data (assoc sym urweb-close-paren))
 	     (urweb-indent-relative sym data))