emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Customizify org-babel-fortran-compiler
@ 2021-06-28  9:34 Nico Sonack
  2021-07-01 14:45 ` Timothy
  0 siblings, 1 reply; 5+ messages in thread
From: Nico Sonack @ 2021-06-28  9:34 UTC (permalink / raw)
  To: emacs-orgmode

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

Hey there,

I've been using org-mode for quite some time already and am pretty
happy!

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Customizify org-babel-fortran-compiler
  2021-06-28  9:34 [PATCH] Customizify org-babel-fortran-compiler Nico Sonack
@ 2021-07-01 14:45 ` Timothy
  0 siblings, 0 replies; 5+ messages in thread
From: Timothy @ 2021-07-01 14:45 UTC (permalink / raw)
  To: emacs-orgmode


Marking as closed in favour of 2nd email.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Customizify org-babel-fortran-compiler
  2021-07-01 14:40 ` Timothy
@ 2021-07-01 21:22   ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2021-07-01 21:22 UTC (permalink / raw)
  To: Timothy; +Cc: Nico Sonack, emacs-orgmode

Hello,

Timothy <tecosaur@gmail.com> writes:

> Thanks for sending in the patch. Seeing it pointed out, this seems like
> a pretty obvious omission. This looks like it should be pretty easy to
> merge :)
>
> Four minor niggles with your commit message:
> + Since `defvar' and `defcustom' are elisp symbols, they should be
>   quoted as such.
> + It's probably better to avoid shorthand like "X -> Y", and write out
>   "Change X to Y" instead.
> + You have included "lisp/" in the commit subject, which isn't needed.
>   Just "ob-fortran.el" or even "ob-fortran" is enough here.
> + Your commit subject goes over 50 chars, which is undesirable.
>
> Here's what I'd recommend:
>
> #+begin_example
> ob-fortran: Use a defcustom for fortran compiler
>
> * lisp/ob-fortran.el (org-babel-fortran-compiler): Change `defvar' to `defcustom'
> so that the fortran compiler is customizable like almost all other org-babel
> compilers.
> #+end_example
>
> This is rather minor though, I mention this mostly as a note for the
> future :)

Thanks.

I went ahead, applied the patch with your recommendation, added
a :package-version keyword, and pushed.

Thanks.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Customizify org-babel-fortran-compiler
  2021-06-28 10:21 Nico Sonack
@ 2021-07-01 14:40 ` Timothy
  2021-07-01 21:22   ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Timothy @ 2021-07-01 14:40 UTC (permalink / raw)
  To: Nico Sonack; +Cc: emacs-orgmode


Hi Nico,

Thanks for sending in the patch. Seeing it pointed out, this seems like
a pretty obvious omission. This looks like it should be pretty easy to
merge :)

Four minor niggles with your commit message:
+ Since `defvar' and `defcustom' are elisp symbols, they should be
  quoted as such.
+ It's probably better to avoid shorthand like "X -> Y", and write out
  "Change X to Y" instead.
+ You have included "lisp/" in the commit subject, which isn't needed.
  Just "ob-fortran.el" or even "ob-fortran" is enough here.
+ Your commit subject goes over 50 chars, which is undesirable.

Here's what I'd recommend:

#+begin_example
ob-fortran: Use a defcustom for fortran compiler

* lisp/ob-fortran.el (org-babel-fortran-compiler): Change `defvar' to `defcustom'
so that the fortran compiler is customizable like almost all other org-babel
compilers.
#+end_example

This is rather minor though, I mention this mostly as a note for the
future :)

--
Timothy

Nico Sonack <nsonack@outlook.com> writes:

> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Customizify org-babel-fortran-compiler
@ 2021-06-28 10:21 Nico Sonack
  2021-07-01 14:40 ` Timothy
  0 siblings, 1 reply; 5+ messages in thread
From: Nico Sonack @ 2021-06-28 10:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-01 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28  9:34 [PATCH] Customizify org-babel-fortran-compiler Nico Sonack
2021-07-01 14:45 ` Timothy
2021-06-28 10:21 Nico Sonack
2021-07-01 14:40 ` Timothy
2021-07-01 21:22   ` Nicolas Goaziou

Code repositories for project(s) associated with this 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).