aboutsummaryrefslogtreecommitdiff
path: root/dev/tools/coqdev.el
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-05-23 14:55:38 +0200
committerEmilio Jesus Gallego Arias2019-05-23 14:55:38 +0200
commit11b8b33f1d7d7fe3f29c83745cc2c06b121a3fb0 (patch)
tree1bc7c4bc1985b16491261cbaaf91b9438a9ca929 /dev/tools/coqdev.el
parenta559c7b6de7854f46ed42869c6100f3751d36ade (diff)
parent56b5d6792962a857f116a2fd62022fe7ae37ae19 (diff)
Merge PR #10214: Better dune ocamldebug integration
Reviewed-by: ejgallego
Diffstat (limited to 'dev/tools/coqdev.el')
-rw-r--r--dev/tools/coqdev.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/dev/tools/coqdev.el b/dev/tools/coqdev.el
index c6687b9731..b89ae67a82 100644
--- a/dev/tools/coqdev.el
+++ b/dev/tools/coqdev.el
@@ -85,6 +85,35 @@ Note that this function is executed before _Coqproject is read if it exists."
(setq-local coq-prog-name (concat dir "bin/coqtop")))))
(add-hook 'hack-local-variables-hook #'coqdev-setup-proofgeneral)
+(defvar coqdev-ocamldebug-command "dune exec dev/dune-dbg"
+ "Command run by `coqdev-ocamldebug'")
+
+(defun coqdev-ocamldebug ()
+ "Runs a command in an ocamldebug buffer."
+ (interactive)
+ (let* ((dir (read-directory-name "Run from directory: "
+ (coqdev-default-directory)))
+ (name "ocamldebug-coq")
+ (buffer-name (concat "*" name "*")))
+ (pop-to-buffer buffer-name)
+ (unless (comint-check-proc buffer-name)
+ (setq default-directory dir)
+ (setq coqdev-ocamldebug-command
+ (read-from-minibuffer "Command to run: "
+ coqdev-ocamldebug-command))
+ (let* ((cmdlist (tuareg--split-args coqdev-ocamldebug-command))
+ (cmdlist (mapcar #'substitute-in-file-name cmdlist)))
+ (apply #'make-comint name
+ (car cmdlist)
+ nil
+ (cdr cmdlist))
+ (set-process-filter (get-buffer-process (current-buffer))
+ #'ocamldebug-filter)
+ (set-process-sentinel (get-buffer-process (current-buffer))
+ #'ocamldebug-sentinel)
+ (ocamldebug-mode)))
+ (ocamldebug-set-buffer)))
+
;; This Elisp snippet adds a regexp parser for the format of Anomaly
;; backtraces (coqc -bt ...), to the error parser of the Compilation
;; mode (C-c C-c: "Compile command: ..."). File locations in traces