 (defvar lfe-font-lock-keywords lfe-font-lock-keywords-1
   "Default expressions to highlight in LFE modes.")
 
+;;; Lisp indent
+
 (defvar calculate-lisp-indent-last-sexp)
 
-;; Copied from lisp-indent-function, but with gets of
-;; lfe-indent-{function,hook}.
 (defun lfe-indent-function (indent-point state)
+  "`INDENT-POINT' is the position where the user typed TAB, or equivalent.
+Point is located at the point to indent under;
+`STATE' is the `parse-partial-sexp' state for that position.
+
+Copied from function `lisp-indent-function',
+but with gets of lfe-indent-{function,hook}."
   (let ((normal-indent (current-column)))
     (goto-char (1+ (elt state 1)))
     (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)

		   "\\(ine\\(-module\\|-function\\|-macro\\|"
		   "-syntax\\|-record\\)?\\)\\|"
		   ;; New model function names
		   "\\(un\\|macro\\|syntax\\)\\|"
		   ;; New model other names
		   "\\(module\\)\\|"
		   "\\(record\\)"

	       (lisp-indent-specform method state
				     indent-point normal-indent))
	      (method
               (funcall method state indent-point normal-indent)))))))

;;; Indentation rule helpers
;; Modified from `clojure-mode'.

(defun put-lfe-indent (sym indent)
  "Instruct `lfe-indent-function' to indent the body of `SYM' by `INDENT'."
  (put sym 'lfe-indent-function indent))

(defmacro define-lfe-indent (&rest kvs)
  "Call `put-lfe-indent' on a series, `KVS'."
  `(progn
     ,@(mapcar (lambda (x)
                 `(put-lfe-indent (quote ,(car x)) ,(cadr x)))
               kvs)))

;;; Special indentation rules
;; "def" anything is already fixed!

;; (define-lfe-indent (begin 0)), say, causes begin to be indented
;; like defun if the first form is placed on the next line, otherwise
;; it is indented like any other form (i.e. forms line up under first).

(define-lfe-indent
  ;; Old style forms.
  (begin 0)
  (let-syntax 1)
  (syntax-rules 0)
  (macro 0)

  ;; New style forms.
  ;; Core forms.
  (progn 0)
  (lambda 1)
  (match-lambda 0)
  (let 1)
  (let-function 1)
  (letrec-function 1)
  (let-macro 1)
  (if 1)
  (case 1)
  (receive 0)
  (catch 0)
  (try 1)
  (after 1)
  (call 2)
  (when 0)
  (eval-when-compile 0)

  ;; Core macros.
  (: 2)
  (let* 1)
  (flet 1)
  (flet* 1)
  (fletrec 1)
  (macrolet 1)
  (syntaxlet 1)
  (do 2)
  (lc 1)
  (bc 1)
  (match-spec 0))

;;;###autoload
;; Associate ".lfe{s,sh}?" with LFE mode.
(add-to-list 'auto-mode-alist '("\\.lfe\\(?:s\\|sh\\)\\'" . lfe-mode) t)

;;;###autoload
;; Ignore files ending in ".jam", ".vee", and ".beam" when performing
