emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nico Sonack <nsonack@outlook.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Customizify org-babel-fortran-compiler
Date: Mon, 28 Jun 2021 12:21:11 +0200 (CEST)	[thread overview]
Message-ID: <AM9PR01MB73931207A7C9B7C7857BD414AC039@AM9PR01MB7393.eurprd01.prod.exchangelabs.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hey there,

I've been using org-mode for quite a while already and am pretty
happy with it!

Today I noticed a minor oddity, that occured when I tried to run some
Fortran code with org-babel: it failed with the compiler not being
found. Looking at the custom variables of the org-babel group, I was
unable to find a compiler option for Fortran. Thus, I quickly patched
the ob-fortran.el and turned the defvar of
`org-babel-fortran-compiler' into a defcustom such that it is a little
more consistent with the rest of the org-babel languages.

The patch is attached to this mail. Please let me know if I should
correct anything.

Nico

--
Sent from hades / FreeBSD 13.0-RELEASE

Please remember: https://useplaintext.email/#etiquette
Do NOT send me Microsoft Office documents. I shall refrain from opening
them.

Nico Sonack <nsonack@outlook.com>

[-- Attachment #2: proposed patch --]
[-- Type: text/plain, Size: 1264 bytes --]

From bdfee720197d94465dfe40776a3f0a249b7ddcb5 Mon Sep 17 00:00:00 2001
From: Nico Sonack <nsonack@outlook.com>
Date: Mon, 28 Jun 2021 11:07:10 +0200
Subject: [PATCH] lisp/ob-fortran.el: Make org-babel-fortran-compiler a custom
 variable

* lisp/ob-fortran.el (org-babel-fortran-compiler): defvar -> defcustom
so that the fortran compiler is customizable like almost all org-babel
compilers.

TINYCHANGE
Sometimes the compiler isn't `gfortran` (but e.g. `gfortran10`
etc.). Accomodate for that like we do with all other org-babel
language integrations.
---
 lisp/ob-fortran.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el
index 99afa0d96..bb2e5d2a3 100644
--- a/lisp/ob-fortran.el
+++ b/lisp/ob-fortran.el
@@ -40,9 +40,11 @@
 
 (defvar org-babel-default-header-args:fortran '())
 
-(defvar org-babel-fortran-compiler "gfortran"
+(defcustom org-babel-fortran-compiler "gfortran"
   "fortran command used to compile a fortran source code file into an
-  executable.")
+  executable."
+  :group 'org-babel
+  :type  'string)
 
 (defun org-babel-execute:fortran (body params)
   "This function should only be called by `org-babel-execute:fortran'."
-- 
2.31.0


             reply	other threads:[~2021-06-28 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 10:21 Nico Sonack [this message]
2021-07-01 14:40 ` [PATCH] Customizify org-babel-fortran-compiler Timothy
2021-07-01 21:22   ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2021-06-28  9:34 Nico Sonack
2021-07-01 14:45 ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR01MB73931207A7C9B7C7857BD414AC039@AM9PR01MB7393.eurprd01.prod.exchangelabs.com \
    --to=nsonack@outlook.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).