Function: neocaml--ocamlformat-args

neocaml--ocamlformat-args is a natively compiled function defined in neocaml.el.

Signature

(neocaml--ocamlformat-args)

Documentation

Return the argument list for invoking ocamlformat on the current buffer.

When the buffer is visiting a file, pass its name via --name so ocamlformat picks up the right .ocamlformat profile and infers implementation vs. interface from the extension. Otherwise fall back to --impl/--intf based on the major mode. ocamlformat reads the source from stdin (the trailing "-").

Source Code

;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
;;;; Formatting

(defun neocaml--ocamlformat-args ()
  "Return the argument list for invoking `ocamlformat' on the current buffer.
When the buffer is visiting a file, pass its name via `--name' so
ocamlformat picks up the right `.ocamlformat' profile and infers
implementation vs. interface from the extension.  Otherwise fall back
to `--impl'/`--intf' based on the major mode.  ocamlformat reads the
source from stdin (the trailing \"-\")."
  (append
   (if buffer-file-name
       (list "--name" buffer-file-name)
     (list (if (derived-mode-p 'neocaml-interface-mode) "--intf" "--impl")))
   (list "-")))