emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 67bd4b0a36 08/17: * lisp/ob-fortran.el: Add support


From: ELPA Syncer
Subject: [elpa] externals/org 67bd4b0a36 08/17: * lisp/ob-fortran.el: Add support for :prologue/:epilogue parameters
Date: Thu, 19 Oct 2023 06:58:51 -0400 (EDT)

branch: externals/org
commit 67bd4b0a36572cd353b4cdab6b1123c1565c3f14
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    * 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 fabc6a47a9..3c3bf8cf42 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]