   "Setup Proofgeneral variables for Coq development.
 
 Note that this function is executed before _Coqproject is read if it exists."
-  (when-let ((dir (coqdev-default-directory)))
-    (unless coq-prog-args ; In case there are file-local variables
-      (setq coq-prog-args `("-coqlib" ,dir
-                            "-R" ,(concat dir "plugins") "Coq"
-                            "-R" ,(concat dir "theories") "Coq")))
-    (setq-local coq-prog-name (concat dir "bin/coqtop"))))
+  (let ((dir (coqdev-default-directory)))
+    (when dir
+      (unless coq-prog-args
+        (setq coq-prog-args
+              `("-coqlib" ,dir "-R" ,(concat dir "plugins")
+                "Coq" "-R" ,(concat dir "theories")
+                "Coq")))
+      (setq-local coq-prog-name (concat dir "bin/coqtop")))))
 (add-hook 'hack-local-variables-hook #'coqdev-setup-proofgeneral)
 
 ;; This Elisp snippet adds a regexp parser for the format of Anomaly

  "Setup ocamldebug for Coq development.

Specifically `camldebug-command-name' and `ocamldebug-command-name'."
  (when-let ((dir (coqdev-default-directory)))
    (setq-local camldebug-command-name (concat dir "dev/ocamldebug-coq"))
    (setq-local ocamldebug-command-name (concat dir "dev/ocamldebug-coq"))))
(add-hook 'hack-local-variables-hook #'coqdev-setup-camldebug)

(defun coqdev-setup-tags ()
  "Setup `tags-file-name' for Coq development."
  (when-let ((dir (coqdev-default-directory)))
      (setq-local tags-file-name (concat dir "TAGS"))))
(add-hook 'hack-local-variables-hook #'coqdev-setup-tags)

(defvar coq-prog-args)


;;; Code:

(defun coqdev-default-directory ()
  "Return the Coq repository containing `default-directory'."
  (let ((dir (locate-dominating-file default-directory "META.coq")))
    (when dir (expand-file-name dir))))

(defun coqdev-setup-compile-command ()
  "Setup `compilate-command' for Coq development."
  (let ((dir (coqdev-default-directory)))
    (when dir (setq-local compile-command (concat "make -C " dir)))))
(add-hook 'hack-local-variables-hook #'coqdev-setup-compile-command)

(defvar camldebug-command-name) ; from camldebug.el (caml package)
