Function: neocaml--check-build-dir

neocaml--check-build-dir is a natively compiled function defined in neocaml.el.

Signature

(neocaml--check-build-dir)

Documentation

If the current file is under _build/, offer to switch to the source.

Intended for use in find-file-hook.

Source Code

;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
(defun neocaml--check-build-dir ()
  "If the current file is under `_build/', offer to switch to the source.
Intended for use in `find-file-hook'."
  (when-let* ((file (buffer-file-name)))
    (when (and neocaml-redirect-build-files
               (derived-mode-p 'neocaml-base-mode)
               (string-match-p "/_build/" file))
      (if-let* ((source (neocaml--resolve-build-path file)))
          (when (y-or-n-p (format "This file is under _build.  Switch to %s? " source))
            (find-alternate-file source))
        (message "Note: this file is under _build/ (no source found)")))))