comparison 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
comparison
equal deleted inserted replaced
371:782ef3ad8c28 372:fe018cbdd41e
510 (search-backward "</" nil t) 510 (search-backward "</" nil t)
511 (urweb-tag-matcher) 511 (urweb-tag-matcher)
512 (beginning-of-line) 512 (beginning-of-line)
513 (current-indentation))) 513 (current-indentation)))
514 514
515 (defconst urweb-sql-starters
516 '("FROM" "WHERE" "GROUP" "ORDER" "HAVING" "LIMIT" "OFFSET"))
517
518 (defconst urweb-sql-starters-re
519 (urweb-syms-re urweb-sql-starters))
520
515 (defun urweb-calculate-indentation () 521 (defun urweb-calculate-indentation ()
516 (save-excursion 522 (save-excursion
517 (beginning-of-line) (skip-chars-forward "\t ") 523 (beginning-of-line) (skip-chars-forward "\t ")
518 (urweb-with-ist 524 (urweb-with-ist
519 ;; Indentation for comments alone on a line, matches the 525 ;; Indentation for comments alone on a line, matches the
563 (skip-syntax-forward ")") 569 (skip-syntax-forward ")")
564 (backward-sexp 1) 570 (backward-sexp 1)
565 (if (urweb-dangling-sym) 571 (if (urweb-dangling-sym)
566 (urweb-indent-default 'noindent) 572 (urweb-indent-default 'noindent)
567 (current-column)))) 573 (current-column))))
574
575 (and (looking-at urweb-sql-starters-re)
576 (save-excursion
577 (and (re-search-backward urweb-sql-starters-re nil t)
578 (current-indentation))))
568 579
569 (and (setq data (assoc sym urweb-close-paren)) 580 (and (setq data (assoc sym urweb-close-paren))
570 (urweb-indent-relative sym data)) 581 (urweb-indent-relative sym data))
571 582
572 (and (member sym urweb-starters-syms) 583 (and (member sym urweb-starters-syms)