2018-09-04 05:03:09 +00:00
|
|
|
;;; dune.el --- Integration with the dune build system
|
2018-08-31 10:12:49 +00:00
|
|
|
|
|
|
|
;; Copyright 2018 Jane Street Group, LLC <opensource@janestreet.com>
|
|
|
|
;; URL: https://github.com/ocaml/dune
|
|
|
|
;; Version: 1.0
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; This package provides helper functions for interacting with the
|
2018-09-04 05:03:09 +00:00
|
|
|
;; dune build system from Emacs.
|
2018-08-31 10:12:49 +00:00
|
|
|
|
|
|
|
;; Installation:
|
|
|
|
;; You need to install the OCaml program ``dune''. The
|
|
|
|
;; easiest way to do so is to install the opam package manager:
|
|
|
|
;;
|
|
|
|
;; https://opam.ocaml.org/doc/Install.html
|
|
|
|
;;
|
|
|
|
;; and then run "opam install dune".
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(defgroup dune nil
|
|
|
|
"Integration with the dune build system."
|
|
|
|
:tag "Dune build system."
|
2018-09-04 05:03:09 +00:00
|
|
|
:version "1.0")
|
2018-08-31 10:12:49 +00:00
|
|
|
|
|
|
|
(defcustom dune-command "dune"
|
|
|
|
"The dune command."
|
2018-09-04 05:03:09 +00:00
|
|
|
:type 'string)
|
2018-08-31 10:12:49 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dune-promote ()
|
|
|
|
"Promote the correction for the current file."
|
|
|
|
(interactive)
|
|
|
|
(if (buffer-modified-p)
|
2018-09-04 05:03:09 +00:00
|
|
|
(error "Cannot promote as buffer is modified")
|
2018-08-31 10:12:49 +00:00
|
|
|
(shell-command
|
|
|
|
(format "%s promote %s"
|
|
|
|
dune-command
|
|
|
|
(file-name-nondirectory (buffer-file-name))))
|
|
|
|
(revert-buffer nil t)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dune-runtest-and-promote ()
|
|
|
|
"Run tests in the current directory and promote the current buffer."
|
|
|
|
(interactive)
|
|
|
|
(compile (format "%s build @@runtest" dune-command))
|
|
|
|
(dune-promote))
|
|
|
|
|
|
|
|
(provide 'dune)
|
|
|
|
|
|
|
|
;;; dune.el ends here
|