Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ocamlformat for emacs setup #48

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion emacs/emacs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,19 @@ let base_setup =
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
(add-hook 'tuareg-mode-hook 'utop-minor-mode))

(defun opam-setup-ocamlformat ()
(load (concat opam-share "/emacs/site-lisp/ocamlformat"))
(opam-setup-add-ocaml-hook
(lambda ()
(define-key tuareg-mode-map (kbd "C-c C-f") #'ocamlformat))))

(defvar opam-tools
'(("tuareg" . opam-setup-tuareg)
("ocp-indent" . opam-setup-ocp-indent)
("ocp-index" . opam-setup-ocp-index)
("merlin" . opam-setup-merlin)
("utop" . opam-setup-utop)))
("utop" . opam-setup-utop)
("ocamlformat" . opam-setup-ocamlformat)))

(defun opam-detect-installed-tools ()
(let*
Expand Down Expand Up @@ -345,9 +352,19 @@ module Merlin = struct
let pre_remove = []
end

module Ocamlformat = struct
(* Handled dynamically, invalid in other switches *)
let name = "ocamlformat"
let chunks = []
let files = []
let post_install = []
let pre_remove = []
end

let tools = [
(module Tuareg : ToolConfig);
(module OcpIndent : ToolConfig);
(module OcpIndex : ToolConfig);
(module Merlin : ToolConfig);
(module Ocamlformat : ToolConfig);
]