               (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)
+
+(defvar encore-imenu-generic-expression
+  '(("passive class" "^\s*passive\s+class\s*\\(.*\\)" 1)
+    ("active class" "^\s*class\s*\\(.*\\)" 1)
+    ("method definition" "^\s*def\s*\\(.*\\) \{?" 1))
+  "Contains regexes to parse Encore with imenu")
+
+(defun encore-imenu-configure ()
+  (interactive)
+  (setq imenu-generic-expression encore-imenu-generic-expression))
+;(setq-local imenu-create-index-function 'imenu-default-create-index-function))
+
+(add-hook 'encore-mode-hook
+	  (lambda ()
+	    (setq imenu-generic-expression (encore-imenu-configure))))
+
+

(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)
  )
)

(setq encore-tab-width 2)
(make-local-variable 'encore-tab-width)

(defun first-word ()
  ""
  (let* ((current-line (current-line))
	 (word-start (string-match "[^ \t]" current-line))
	 (word-end (string-match "[^a-zA-Z]" current-line word-start)))
    (substring-no-properties current-line word-start word-end)))

(defun classify-indent (line first)
