Skip to content

Commit 1305060

Browse files
author
Arvid Jakobsson
committed
[emacs] add [dune-find-dominating] command
Signed-off-by: Arvid Jakobsson <[email protected]>
1 parent 6d9089e commit 1305060

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

editor-integration/emacs/dune.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,17 @@ For customization purposes, use `dune-mode-hook'."
426426
(compile (format "%s build @@runtest" dune-command))
427427
(dune-promote))
428428

429+
;;;###autoload
430+
(defun dune-find-dominating ()
431+
"Find dominating dune file."
432+
(interactive)
433+
(if-let* ((dune-file (locate-dominating-file "." "dune"))
434+
(dune-file (concat dune-file "dune")))
435+
(progn
436+
(xref-push-marker-stack)
437+
(find-file dune-file))
438+
(error "Found no dune file dominating %s" default-directory)))
439+
429440
(defun dune-project-p (directory)
430441
"Return t if DIRECTORY is a dune project."
431442
(file-exists-p (expand-file-name "dune-project" directory)))

0 commit comments

Comments
 (0)