 (defvar slate-mode-abbrev-table nil
   "Abbrev table in use in slate-mode buffers.")
 (define-abbrev-table 'slate-mode-abbrev-table ())
+
+;; Customize Support
+;; =================
+
+(defgroup slate nil
+  "Major mode for editing Slate code."
+  :prefix "slate-"
+  :group 'languages)
+
+(defcustom slate-mode-hook nil
+  "Normal hook run when entering Slate mode."
+  :type 'hook
+  :options '(imenu-add-menubar-index)
+  :group 'slate)
+
+(defcustom slate-indent-amount 2
+  "Amount to adjust indentation by."
+  :type 'integer
+  :options '(2 4)
+  :group 'slate)
 
 ;; Templates
 ;; =========

     . font-lock-keyword-face)		; globals
   )
  "Slate highlighting matchers.")

(defconst slate-indent-amount 2
  "*'Tab size'; used for simple indentation alignment.")

;; Inferior-Mode Support
;; =====================

           (backward-sexp)
           (decf n)))))

(defun slate-find-statement-begin ()
  "Leaves the point at the first non-blank, non-comment character of a new
statement.  If beginning of buffer is reached, then the point is left there.
This routine only will return with the point pointing at the first non-blank
on a line; it won't be fooled by multiple statements on a line into stopping
prematurely.  Also, goes to start of method if we started in the method
selector."
  (let (start ch)
    (when (equal (preceding-char) ?.) ; if we start at eos
      (backward-char 1))	      ; we find the begin of THAT stmt
    (while (and (null start) (not (bobp)))
      (slate-backward-whitespace)
      (setq ch (preceding-char))
      (cond ((equal ch ?.)
	     (let (saved-point)
	       (setq saved-point (point))
	       (slate-forward-whitespace)
	       (if (slate-white-to-bolp)
		   (setq start (point))
		 (goto-char saved-point)
		 (slate-backward-sexp 1))))
	    ((equal ch ?^)	 ; HACK -- presuming that when we back
					;up into a return that we're at the
					;start of a statement
	     (backward-char 1)
	     (setq start (point)))
	    ((equal ch ?\[)
	     (if (> (current-column) 1)
		 (setq start (point))
	       (forward-line 1)
	       (beginning-of-line)
	       (slate-forward-whitespace)
	       (setq start (point))))
	    ((equal ch ?\{)
	     (setq start (point)))
	    ((equal ch ?\()
	     (backward-char 1))
	    ((equal ch ?|)
	     (backward-char 1)
	     (skip-chars-backward "^[")
	     (slate-backward-whitespace))
	    (t
	     (slate-backward-sexp 1))))
    (unless start
      (goto-char (point-min))
      (slate-forward-whitespace)
      (setq start (point)))
    start))

(defun slate-calculate-indent ()
  "The core calculations for indentation."
  (let (indent-amount start-of-line state (parse-sexp-ignore-comments t))
