 (setq encore-comment-regexp "--.?*")
 
 (setq encore-font-lock-keywords
- `(
-    (,encore-comment-regexp    . font-lock-comment-face)
-    (,encore-keywords-regexp   . font-lock-keyword-face)
-    (,encore-danger-regexp     . font-lock-warning-face)
-    (,encore-constants-regexp  . font-lock-constant-face)
-    (,encore-primitives-regexp . font-lock-type-face)
-    (,encore-types-regexp      . font-lock-type-face)
-    (,encore-function-regexp   1 font-lock-function-name-face)
-    (,encore-variable-regexp   1 font-lock-variable-name-face)
-  )
-)
+      `(
+	(,encore-comment-regexp    . font-lock-comment-face)
+	(,encore-keywords-regexp   . font-lock-keyword-face)
+	(,encore-danger-regexp     . font-lock-warning-face)
+	(,encore-constants-regexp  . font-lock-constant-face)
+	(,encore-primitives-regexp . font-lock-type-face)
+	(,encore-types-regexp      . font-lock-type-face)
+	(,encore-function-regexp   1 font-lock-function-name-face)
+	(,encore-variable-regexp   1 font-lock-variable-name-face)
+	)
+      )
 
 (setq encore-tab-width 2)
 (make-local-variable 'encore-tab-width)

              (setq encore-last-indent 100))
          (setq encore-last-indent indent)))))
  (if (looking-back "^[ \t]*") (back-to-indentation))
)

(define-derived-mode encore-mode prog-mode
  (setq font-lock-defaults '(encore-font-lock-keywords))
  (setq mode-name "Encore")
  (set (make-local-variable 'indent-line-function) 'encore-indent-line)
)

;; Open "*.enc" in encore-mode
(add-to-list 'auto-mode-alist '("\\.enc\\'" . encore-mode))

(provide 'encore-mode)

  (if (equal first "class")
      0

    (if (equal first "def")
	(if (string-match "\\<def\\>" line)
	    (match-beginning 0)
	  (if (string-match "\\<passive\\>" line)
	      (+ (match-beginning 0) encore-tab-width)
	    (if (string-match "\\<class\\>" line)
		(+ (match-beginning 0) encore-tab-width))))

      (if (string-match "\\<passive\\> .*" line)
	  (+ (match-beginning 0) encore-tab-width)

	(if (string-match "\\<class\\> .*" line)
	    (+ (match-beginning 0) encore-tab-width)

	  (if (string-match "\\<if\\>.*\\<then\\>.*\\<else\\>" line)
	      (match-beginning 0)
	    (if (string-match "\\<if\\>.*\\<then\\>" line)
		(if (equal first "else")
		    (match-beginning 0)
		  (+ (match-beginning 0) encore-tab-width))
	      (if (string-match "\\<then\\>" line)
		  (if (equal first "else")
		      (match-beginning 0)
		    (+ (match-beginning 0) encore-tab-width))
		(if (string-match "\\<if\\>.*" line)
		    (if (or (equal first "then") (equal first "else"))
			(match-beginning 0)
		      (let ((indent (string-match "[^ \t]" line (+ (match-beginning 0) 2)))) (if indent indent (+ (match-beginning 0) encore-tab-width))))
		  (if (string-match "\\<else\\>.*" line)
		      (+ (match-beginning 0) encore-tab-width)

		    (if (string-match "\\<while\\>" line)
			(+ (match-beginning 0) encore-tab-width)

		      (if (string-match "\\<let\\>.*\\<in\\>$" line)
			  (+ (match-beginning 0) encore-tab-width)

			(if (string-match "\\<embed\\>.*\\<end\\>" line)
			    (match-beginning 0)
			  (if (string-match "\\<embed\\>" line)
			      (if (equal first "end")
				  (match-beginning 0)
				(+ (match-beginning 0) encore-tab-width))

			    (if (string-match "\\<let\\>\\W*\\(\\w+\\)" line)
				(if (equal "in" first)
				    (match-beginning 0)
				  (match-beginning 1))
			      (if (string-match "\\<let\\>" line)
				  (if (equal "in" first)
				      (match-beginning 0)
				    (+ (match-beginning 0) encore-tab-width))
				(if (string-match "\\<in\\>[ \t]*$" line)
				    (+ (match-beginning 0) encore-tab-width)

				  (if (string-match "\\<def\\>" line)
				      (+ (match-beginning 0) encore-tab-width)

				    (if (string-match "\\W*\\([^;]*\\);" line)
					(match-beginning 1)
				      (if (bobp)
					  0))))))))))))))))))))

(setq encore-checked-line nil)
(make-local-variable 'encore-checked-line)
