feat(fortran): SPC m f o opens project config

This commit is contained in:
Colin Woodbury 2023-09-08 15:33:05 +09:00 committed by Henrik Lissner
parent 56187fc35a
commit 3a01faed49
2 changed files with 13 additions and 2 deletions

View file

@ -63,7 +63,7 @@ or gfortran, depending on what feature flags are set."
(_ "")))
;;;###autoload
(defun +fortran-compilation-buffer-name-fn (mode)
(defun +fortran-compilation-buffer-name-fn (_mode)
"The name of the buffer produced by `compile'."
"*fortran-compilation*")
@ -115,3 +115,13 @@ or gfortran, depending on what feature flags are set."
"Test the current project using fpm."
(interactive)
(compile "fpm test"))
;;;###autoload
(defun +fortran/fpm-open-project-toml (project-root)
"Open fpm.toml at PROJECT-ROOT (defaults to the open project)."
(interactive (list (doom-project-root)))
(let ((file (file-name-concat project-root "fpm.toml")))
(cond ((file-exists-p file) (find-file file))
((null project-root) (user-error "Not in a project"))
(t (user-error "No fpm.toml found at project root (%s)"
(abbreviate-file-name project-root))))))

View file

@ -27,7 +27,8 @@
(:prefix ("f" . "fpm")
:desc "fpm build" "b" #'+fortran/fpm-build
:desc "fpm run" "r" #'+fortran/fpm-run
:desc "fpm test" "t" #'+fortran/fpm-test)
:desc "fpm test" "t" #'+fortran/fpm-test
:desc "Open project config" "o" #'+fortran/fpm-open-project-toml)
(:prefix ("g" . "gfortran")
:desc "compile" "c" #'+fortran/gfortran-compile
:desc "run" "r" #'+fortran/gfortran-run)