From 67bd4b0a36572cd353b4cdab6b1123c1565c3f14 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 19 Oct 2023 11:58:39 +0300 Subject: [PATCH] * lisp/ob-fortran.el: Add support for :prologue/:epilogue parameters (org-babel-expand-body:fortran): --- lisp/ob-fortran.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el index fabc6a47a..3c3bf8cf4 100644 --- a/lisp/ob-fortran.el +++ b/lisp/ob-fortran.el @@ -85,6 +85,8 @@ This function is called by `org-babel-execute-src-block'." (defun org-babel-expand-body:fortran (body params) "Expand a fortran BODY according to its header arguments defined in PARAMS." (let ((vars (org-babel--get-vars params)) + (prologue (cdr (assq :prologue params))) + (epilogue (cdr (assq :epilogue params))) (main-p (not (string= (cdr (assq :main params)) "no"))) (includes (or (cdr (assq :includes params)) (org-babel-read (org-entry-get nil "includes" t)))) @@ -107,9 +109,16 @@ This function is called by `org-babel-execute-src-block'." (concat ;; variables (mapconcat 'org-babel-fortran-var-to-fortran vars "\n") - body) + (and prologue (concat prologue "\n")) + body + (and prologue (concat prologue "\n"))) params) - body) "\n") "\n"))) + (concat + (and prologue (concat prologue "\n")) + body + (and epilogue (concat "\n" epilogue "\n")))) + "\n") + "\n"))) (defun org-babel-fortran-ensure-main-wrap (body params) "Wrap BODY in a \"program ... end program\" block if none exists.