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

emacs: setup dune mode if available #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ Without argument, the current setup status will be checked and printed.
This should reflect the current state of support for editors and tools. More may
be added.

|editor |base template|ocaml |ocp-indent|merlin|ocp-index|
|-------|-------------|--------|----------|------|---------|
|emacs |yes |yes |yes |yes |yes |
|vim |yes |yes |yes |yes |yes |
|sublime|no |built-in|no |no |yes |
|gedit |not yet | | | | |
|eclipse|not yet | | | | |
|editor |base template|ocaml |ocp-indent|merlin|ocp-index|dune|
|-------|-------------|--------|----------|------|---------|----|
|emacs |yes |yes |yes |yes |yes |yes |
|vim |yes |yes |yes |yes |yes |no |
|sublime|no |built-in|no |no |yes |no |
|gedit |not yet | | | | |no |
|eclipse|not yet | | | | |no |

Current support in emacs and vim (only) is dynamic, which means that the editor
will adapt to the current opam switch when run (using e.g. merlin only when
Expand Down
6 changes: 6 additions & 0 deletions emacs/emacs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,17 @@ let base_setup =
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
(add-hook 'tuareg-mode-hook 'utop-minor-mode))

(defun opam-setup-dune ()
(load "dune.el")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this blow up if dune.el is not on Emacs's load-path?

(add-to-list 'auto-mode-alist '("/dune\\'" . dune-mode))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also dune-project.

)

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

(defun opam-detect-installed-tools ()
Expand Down