module: add :lang fortran
* 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
This commit is contained in:
parent
d43f260af6
commit
f3ddf235b5
5 changed files with 206 additions and 0 deletions
54
modules/lang/fortran/autoload.el
Normal file
54
modules/lang/fortran/autoload.el
Normal file
|
@ -0,0 +1,54 @@
|
|||
;;; 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*")
|
Loading…
Add table
Add a link
Reference in a new issue