            (if (zerop
                  (apply 'call-process
                    ocamlformat-command nil (list :file errorfile) nil
-                   (append margin-args
-                     (append enable-args
-                       (list
-                         "--name" buffer-file-name
-                         "--output" outputfile bufferfile)))))
+                      (append margin-args enable-args extension-args
+                              (list
+                               "--name" buffer-file-name
+                               "--output" outputfile bufferfile))))
              (progn
                (if ocamlformat--support-replace-buffer-contents
                    (ocamlformat--replace-buffer-contents outputfile)

          (const :tag "Fill column" fill)
          (const :tag "None" nil))
  :group 'ocamlformat)

;;;###autoload
(defun ocamlformat-before-save ()

            ((equal ocamlformat-enable 'enable-outside-detected-project)
             (list "--enable-outside-detected-project"))
            (t
             '())))
          (extension-args
           (cond
            ((eq ocamlformat-file-kind 'implementation)
             (list "--impl"))
            ((eq ocamlformat-file-kind 'interface)
             (list "--intf")))))
     (unwind-protect
         (save-restriction
           (widen)
