refactor(fortran): conform to conventions
This commit is contained in:
parent
9cba28621f
commit
3a3a8dc240
2 changed files with 18 additions and 17 deletions
|
@ -1,13 +1,25 @@
|
||||||
;;; lang/fortran/autoload.el -*- lexical-binding: t; -*-
|
;;; lang/fortran/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; --- GFORTRAN --- ;;
|
;;
|
||||||
|
;;; GFortran
|
||||||
|
|
||||||
|
(defun +fortran--std ()
|
||||||
|
"Which version of Fortran should we target?"
|
||||||
|
(pcase major-mode
|
||||||
|
(`fortran-mode "-std=legacy")
|
||||||
|
(_ "")))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +fortran-compilation-buffer-name-fn (mode)
|
||||||
|
"The name of the buffer produced by `compile'."
|
||||||
|
"*fortran-compilation*")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +fortran/gfortran-compile ()
|
(defun +fortran/gfortran-compile ()
|
||||||
"Compile the current buffer using gfortran."
|
"Compile the current buffer using gfortran."
|
||||||
(interactive)
|
(interactive)
|
||||||
(compile (format "gfortran %s %s"
|
(compile (format "gfortran %s %s"
|
||||||
(+fortran/fortran-std)
|
(+fortran--std)
|
||||||
buffer-file-name)))
|
buffer-file-name)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -20,13 +32,9 @@
|
||||||
(sleep-for 1))
|
(sleep-for 1))
|
||||||
(compile "./a.out"))
|
(compile "./a.out"))
|
||||||
|
|
||||||
(defun +fortran/fortran-std ()
|
|
||||||
"Which version of Fortran should we target?"
|
|
||||||
(cl-case major-mode
|
|
||||||
(fortran-mode "-std=legacy")
|
|
||||||
(t "")))
|
|
||||||
|
|
||||||
;; --- FPM --- ;;
|
;;
|
||||||
|
;;; FPM
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +fortran/fpm-build ()
|
(defun +fortran/fpm-build ()
|
||||||
|
@ -45,10 +53,3 @@
|
||||||
"Test the current project using fpm."
|
"Test the current project using fpm."
|
||||||
(interactive)
|
(interactive)
|
||||||
(compile "fpm test"))
|
(compile "fpm test"))
|
||||||
|
|
||||||
;; --- MISC. --- ;;
|
|
||||||
;;;###autoload
|
|
||||||
(defun +fortran/compilation-buffer-name (mode)
|
|
||||||
"The name of the buffer produced by `compile'."
|
|
||||||
(interactive)
|
|
||||||
"*fortran-compilation*")
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
;; Used by `compile' (SPC c c)
|
;; Used by `compile' (SPC c c)
|
||||||
(setq-hook! 'f90-mode-hook
|
(setq-hook! 'f90-mode-hook
|
||||||
compile-command "gfortran "
|
compile-command "gfortran "
|
||||||
compilation-buffer-name-function #'+fortran/compilation-buffer-name)
|
compilation-buffer-name-function #'+fortran-compilation-buffer-name-fn)
|
||||||
(set-popup-rule! "^\\*fortran-compilation" :side 'right :size 0.5 :quit t)
|
(set-popup-rule! "^\\*fortran-compilation" :side 'right :size 0.5 :quit t)
|
||||||
|
|
||||||
;; --- LSP Configuration --- ;;
|
;; --- LSP Configuration --- ;;
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
;; Used by `compile' (SPC c c)
|
;; Used by `compile' (SPC c c)
|
||||||
(setq-hook! 'fortran-mode-hook ; TODO These work for f90 but not for fortran.
|
(setq-hook! 'fortran-mode-hook ; TODO These work for f90 but not for fortran.
|
||||||
compile-command "gfortran -std=legacy "
|
compile-command "gfortran -std=legacy "
|
||||||
compilation-buffer-name-function #'+fortran/compilation-buffer-name)
|
compilation-buffer-name-function #'+fortran-compilation-buffer-name-fn)
|
||||||
(set-popup-rule! "^\\*fortran-compilation" :side 'right :size 0.5 :quit t)
|
(set-popup-rule! "^\\*fortran-compilation" :side 'right :size 0.5 :quit t)
|
||||||
|
|
||||||
;; --- LSP --- ;;
|
;; --- LSP --- ;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue