* feat(fortran): account for f90 and fortran modes * feat(fortran): initial keybindings * feat(fortran): basic compilation * feat(fortran): compilation popup This customizes the name of the compilation buffer produced by the `compile` function. We're keeping things simple; Emacs already knows how to run compilation commands in a popup and parse the results, so let's let it do its thing. * feat(fortran): doctor checks * docs(fortran): installation instructions * feat(fortran): actual usage of fpm * feat(fortran): configure compilation popups * feat(fortran): improved raw gfortran usage Although it's recommended to do everything through `fpm` to make life easier. * docs(fortran): backburner `+intel` for now * feat(fortran): address PR suggestions
54 lines
1.2 KiB
EmacsLisp
54 lines
1.2 KiB
EmacsLisp
;;; lang/fortran/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
;; --- GFORTRAN --- ;;
|
|
|
|
;;;###autoload
|
|
(defun +fortran/gfortran-compile ()
|
|
"Compile the current buffer using gfortran."
|
|
(interactive)
|
|
(compile (format "gfortran %s %s"
|
|
(+fortran/fortran-std)
|
|
buffer-file-name)))
|
|
|
|
;;;###autoload
|
|
(defun +fortran/gfortran-run ()
|
|
"Run the current buffer using gfortran."
|
|
(interactive)
|
|
(delete-file "./a.out")
|
|
(+fortran/gfortran-compile)
|
|
(while (not (file-exists-p "./a.out"))
|
|
(sleep-for 1))
|
|
(compile "./a.out"))
|
|
|
|
(defun +fortran/fortran-std ()
|
|
"Which version of Fortran should we target?"
|
|
(cl-case major-mode
|
|
(fortran-mode "-std=legacy")
|
|
(t "")))
|
|
|
|
;; --- FPM --- ;;
|
|
|
|
;;;###autoload
|
|
(defun +fortran/fpm-build ()
|
|
"Build the current project using fpm."
|
|
(interactive)
|
|
(compile "fpm build"))
|
|
|
|
;;;###autoload
|
|
(defun +fortran/fpm-run ()
|
|
"Run the current project using fpm."
|
|
(interactive)
|
|
(compile "fpm run"))
|
|
|
|
;;;###autoload
|
|
(defun +fortran/fpm-test ()
|
|
"Test the current project using fpm."
|
|
(interactive)
|
|
(compile "fpm test"))
|
|
|
|
;; --- MISC. --- ;;
|
|
;;;###autoload
|
|
(defun +fortran/compilation-buffer-name (mode)
|
|
"The name of the buffer produced by `compile'."
|
|
(interactive)
|
|
"*fortran-compilation*")
|