 
 \\{haml-mode-map}"
   (set-syntax-table haml-mode-syntax-table)
+  (add-to-list 'font-lock-extend-region-functions 'haml-extend-region)
+  (set (make-local-variable 'font-lock-multiline) t)
   (set (make-local-variable 'indent-line-function) 'haml-indent-line)
   (set (make-local-variable 'indent-region-function) 'haml-indent-region)
+  (set (make-local-variable 'parse-sexp-lookup-properties) t)
   (setq indent-tabs-mode nil)
   (setq font-lock-defaults '((haml-font-lock-keywords) nil t)))
 

  (kill-line 1)
  (haml-reindent-region-by (* -1 haml-indent-offset)))

;; Setup/Activation

(provide 'haml-mode)

    ("^ *[\\.#%a-z0-9_]+\\({[^}]+}\\)"      1 font-lock-preprocessor-face prepend)
    ("^ *[\\.#%a-z0-9_]+\\(\\[[^]]+\\]\\)"  1 font-lock-preprocessor-face prepend)))

(defconst haml-filter-re "^ *\\(:\\)\\w+")
(defconst haml-comment-re "^ *\\(-\\)\\#")

(defun* haml-extend-region ()
  "Extend the font-lock region to encompass filters and comments."
  (let ((old-beg font-lock-beg)
        (old-end font-lock-end))
    (save-excursion
      (goto-char font-lock-beg)
      (beginning-of-line)
      (unless (or (looking-at haml-filter-re)
                  (looking-at haml-comment-re))
        (return-from haml-extend-region))
      (setq font-lock-beg (point))
      (haml-forward-sexp)
      (beginning-of-line)
      (setq font-lock-end (max font-lock-end (point))))
    (or (/= old-beg font-lock-beg)
        (/= old-end font-lock-end))))


;; Mode setup

(defvar haml-mode-syntax-table
