   "String to put in the margin of a line containing a warning."
   :group 'merlin :type 'string)
 
-(defcustom merlin-error-after-save t
-  "If non-nil, check for errors after saving"
-  :group 'merlin :type 'boolean)
+(defcustom merlin-error-after-save '("ml" "mli")
+  "Determines whether merlin should check for errors after saving.
+If t, always check for errors after saving.
+If nil, never check.
+If a string list, check only if the extension of the buffer-file-name is in the list."
+  :group 'merlin :type '(choice (repeat string) boolean))
 
 (defcustom merlin-error-in-margin t
   "If non-nil, display errors in margin"

  "Return the process configuration of the current buffer."
  (buffer-local-value 'merlin-process-data (merlin-process-buffer)))

(defun merlin-toggle-view-errors ()
  "Toggle the viewing of errors in the buffer."
  (interactive)
  (setq merlin-error-after-save (not merlin-error-after-save))
  (if merlin-error-after-save
      (progn
        (merlin-after-save)
        (message "Errors are now reported. Use %s to stop reporting them."

     )))

(defun merlin-after-save ()
  (when (merlin-error-after-save) (merlin-error-check)))

(add-hook 'merlin-mode-hook
          (lambda ()
