       (define-key m (vector '(control ?c) key) cmd)
       (define-key m (vector '(control ?c) `(control ,key)) cmd))))
 
+(defun factor--define-auto-indent-key (key)
+  (define-key factor-mode-map (vector key)
+    (lambda (n)
+      (interactive "p")
+      (self-insert-command n)
+      (indent-for-tab-command))))
+
 (factor--define-key ?f 'factor-run-file)
 (factor--define-key ?r 'factor-send-region)
 (factor--define-key ?d 'factor-send-definition)

            (cl (factor--ppss-brackets-end))
            (ln (line-number-at-pos)))
        (when (> ln (line-number-at-pos op))
          (if (= ln (line-number-at-pos cl))
              (factor--indentation-at op)
            (factor--increased-indentation (factor--indentation-at op))))))))


(defsubst factor--looking-at-emptiness ()
  (looking-at "^[ \t]*$"))

(defconst factor--regex-end-of-def-line
  (format "^.*%s" factor--regex-definition-end))

(defsubst factor--at-end-of-def ()
  (or (looking-at factor--regex-end-of-def-line)
      (looking-at factor--regex-single-liner)))

(defun factor--at-setter-line ()
