1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Emacs] Make indentation work with more than just tags.

This commit is contained in:
Nathan Weizenbaum 2008-05-10 22:24:52 -07:00
parent ad2ed968de
commit 3e922fbd42

View file

@ -54,8 +54,9 @@ if the next line could be nested within this line.")
(defvar haml-block-openers (defvar haml-block-openers
`("^ *\\([%\\.#][^ \t]*\\)\\(\\[.*\\]\\)?\\({.*}\\)?\\(\\[.*\\]\\)?[ \t]*$" `("^ *\\([%\\.#][^ \t]*\\)\\(\\[.*\\]\\)?\\({.*}\\)?\\(\\[.*\\]\\)?[ \t]*$"
"^ *[-=].*do[ \t]*\\(|.*|[ \t]*\\)?$" "^ *[-=].*do[ \t]*\\(|.*|[ \t]*\\)?$"
,(concat "^ *-[ \t]*" ,(concat "^ *-[ \t]*\\("
(regexp-opt '("else" "elsif" "rescue" "ensure" "when"))) (regexp-opt '("else" "elsif" "rescue" "ensure" "when"))
"\\)")
"^ */\\(\\[.*\\]\\)?[ \t]*$" "^ */\\(\\[.*\\]\\)?[ \t]*$"
"^ *-#" "^ *-#"
"^ *:") "^ *:")
@ -219,7 +220,7 @@ character of the next line."
"Returns true if the current line can have lines nested beneath it." "Returns true if the current line can have lines nested beneath it."
(loop for opener in haml-block-openers (loop for opener in haml-block-openers
if (looking-at opener) return t if (looking-at opener) return t
return nil)) finally return nil))
(defun haml-compute-indentation () (defun haml-compute-indentation ()
"Calculate the maximum sensible indentation for the current line." "Calculate the maximum sensible indentation for the current line."