emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Question on contributing to Org-mode
@ 2020-06-13 21:58 Ag Ibragimov
  2020-06-14  0:19 ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Ag Ibragimov @ 2020-06-13 21:58 UTC (permalink / raw)
  To: emacs-orgmode


I have never ever before tried contributing patches to Org-mode, mainly because it is such a big project that I am rarely sure if whatever I'm trying to do is right.

Finally, I've found something that perhaps I could improve. Namely, I wanted to extend Clojure code blocks to be executed with clj command line tool and babashka. I have cloned the project from https://code.orgmode.org/bzg/org-mode, found ob-clojure.el and realized that org-babel-execute:clojure function is not the same as the one is being used in my Emacs.

M-x emacs-version and org-version report:

GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101)) of 2020-06-07
Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @ ~/.emacs.d/elpa/28.0/develop/org-plus-contrib-20200608/)

Now I'm confused, what's in master of bzg/org-mode? And if someone wants to send patches, which branch it should be based of?


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

* Re: Question on contributing to Org-mode
  2020-06-13 21:58 Question on contributing to Org-mode Ag Ibragimov
@ 2020-06-14  0:19 ` Kyle Meyer
  2020-06-18  1:32   ` Ag Ibragimov
  0 siblings, 1 reply; 4+ messages in thread
From: Kyle Meyer @ 2020-06-14  0:19 UTC (permalink / raw)
  To: Ag Ibragimov; +Cc: emacs-orgmode

Ag Ibragimov writes:

> M-x emacs-version and org-version report:
>
> GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101)) of 2020-06-07
> Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @ ~/.emacs.d/elpa/28.0/develop/org-plus-contrib-20200608/)
>
> Now I'm confused, what's in master of bzg/org-mode?

It contains what will be the next feature release (9.4, at the moment).

Notice that your reported version above contains a git revision: 706970.
If you look that up in the repo, you'll find that it's a few commits
back from the current tip of the maint branch.  The maint branch is the
source for the ELPA builds and is where bug fix releases are cut from.

> And if someone wants to send patches, which branch it should be based
> of?

Bug fixes that apply to maint should ideally be based off of maint, and
master is usually appropriate for everything else.


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

* Re: Question on contributing to Org-mode
  2020-06-14  0:19 ` Kyle Meyer
@ 2020-06-18  1:32   ` Ag Ibragimov
  2020-06-18  6:50     ` stardiviner
  0 siblings, 1 reply; 4+ messages in thread
From: Ag Ibragimov @ 2020-06-18  1:32 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

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

Can someone help me please to improve ob-clojure for the next release.

I'd like to add bababashka and clojure-cmd support.

I've experimented with the code that's currently in master I so far I got to this.

What I would like to propose:

1) Ability to override `org-babel-clojure-backend` with a src-block header parameter
2) Header argument for additional parameters so you could do things like this:

#+begin_src clojure :args "-Sdeps '{:deps {inflections {:mvn/version "0.13.2"}}}'"
  (use 'inflections.core)
  (plural "word")
#+end_src

However, I don't know what's current convention about header parameters - naming, etc.
What your thoughts about all that?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ob-clojure-improvements-draft.patch --]
[-- Type: text/x-patch, Size: 1460 bytes --]

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 299a326e4..de005c32b 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -224,6 +224,14 @@ (defun ob-clojure-eval-with-slime (expanded params)
        ,(buffer-substring-no-properties (point-min) (point-max)))
      (cdr (assq :package params)))))
 
+(defun ob-clojure-eval-with-babashka (expanded params)
+  "Evaluate EXPANDED code block with PARAMS using babashka."
+  (org-babel-execute:shell (format "bb -e \"%s\"" expanded) params))
+
+(defun ob-clojure-eval-with-clj (expanded params)
+  "Evaluate EXPANDED code block with PARAMS using clojure-cli."
+  (org-babel-execute:shell (format "clj -e \"%s\"" expanded) params))
+
 (defun org-babel-execute:clojure (body params)
   "Execute a block of Clojure code with Babel."
   (unless org-babel-clojure-backend
@@ -238,7 +246,11 @@ (defun org-babel-execute:clojure (body params)
 	   ((eq org-babel-clojure-backend 'cider)
 	    (ob-clojure-eval-with-cider expanded params))
 	   ((eq org-babel-clojure-backend 'slime)
-	    (ob-clojure-eval-with-slime expanded params))))
+	    (ob-clojure-eval-with-slime expanded params))
+	   ((eq org-babel-clojure-backend 'babashka)
+	    (ob-clojure-eval-with-babashka expanded params))
+	   ((eq org-babel-clojure-backend 'clj-cli)
+	    (ob-clojure-eval-with-clj expanded params))))
     (org-babel-result-cond result-params
       result
       (condition-case nil (org-babel-script-escape result)

[-- Attachment #3: Type: text/plain, Size: 1014 bytes --]


On Sat 13 Jun 2020 at 17:19, Kyle Meyer <kyle@kyleam.com> wrote:

> Ag Ibragimov writes:
>
>> M-x emacs-version and org-version report:
>>
>> GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101)) of 2020-06-07
>> Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @ ~/.emacs.d/elpa/28.0/develop/org-plus-contrib-20200608/)
>>
>> Now I'm confused, what's in master of bzg/org-mode?
>
> It contains what will be the next feature release (9.4, at the moment).
>
> Notice that your reported version above contains a git revision: 706970.
> If you look that up in the repo, you'll find that it's a few commits
> back from the current tip of the maint branch.  The maint branch is the
> source for the ELPA builds and is where bug fix releases are cut from.
>
>> And if someone wants to send patches, which branch it should be based
>> of?
>
> Bug fixes that apply to maint should ideally be based off of maint, and
> master is usually appropriate for everything else.


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

* Re: Question on contributing to Org-mode
  2020-06-18  1:32   ` Ag Ibragimov
@ 2020-06-18  6:50     ` stardiviner
  0 siblings, 0 replies; 4+ messages in thread
From: stardiviner @ 2020-06-18  6:50 UTC (permalink / raw)
  To: Ag Ibragimov; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Can someone help me please to improve ob-clojure for the next release.
>
> I'd like to add bababashka and clojure-cmd support.
>
> I've experimented with the code that's currently in master I so far I got to this.
>
> What I would like to propose:
>
> 1) Ability to override `org-babel-clojure-backend` with a src-block header parameter

I like this idea, currently ob-clojure has many different backends support now,
Use a header argument will be helpful for situations like use different backends
in one org file and other cases.

> 2) Header argument for additional parameters so you could do things like this:

I would like propose header argument name ":backend" or ":clojure". ob-scheme.el
has similar header argument named ":scheme". But I prefer ":backend", because
it's more general.

>
> #+begin_src clojure :args "-Sdeps '{:deps {inflections {:mvn/version "0.13.2"}}}'"
>  (use 'inflections.core)
>  (plural "word")
> #+end_src
>
> However, I don't know what's current convention about header parameters - naming, etc.
> What your thoughts about all that?
>
> diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
> index 299a326e4..de005c32b 100644
> --- a/lisp/ob-clojure.el
> +++ b/lisp/ob-clojure.el
> @@ -224,6 +224,14 @@ (defun ob-clojure-eval-with-slime (expanded params)
>        ,(buffer-substring-no-properties (point-min) (point-max)))
>      (cdr (assq :package params)))))
>
> +(defun ob-clojure-eval-with-babashka (expanded params)
> +  "Evaluate EXPANDED code block with PARAMS using babashka."
> +  (org-babel-execute:shell (format "bb -e \"%s\"" expanded) params))
> +
> +(defun ob-clojure-eval-with-clj (expanded params)
> +  "Evaluate EXPANDED code block with PARAMS using clojure-cli."
> +  (org-babel-execute:shell (format "clj -e \"%s\"" expanded) params))
> +
> (defun org-babel-execute:clojure (body params)
>   "Execute a block of Clojure code with Babel."
>   (unless org-babel-clojure-backend
> @@ -238,7 +246,11 @@ (defun org-babel-execute:clojure (body params)
> 	   ((eq org-babel-clojure-backend 'cider)
> 	    (ob-clojure-eval-with-cider expanded params))
> 	   ((eq org-babel-clojure-backend 'slime)
> -	    (ob-clojure-eval-with-slime expanded params))))
> +	    (ob-clojure-eval-with-slime expanded params))
> +	   ((eq org-babel-clojure-backend 'babashka)
> +	    (ob-clojure-eval-with-babashka expanded params))
> +	   ((eq org-babel-clojure-backend 'clj-cli)
> +	    (ob-clojure-eval-with-clj expanded params))))
>     (org-babel-result-cond result-params
>       result
>       (condition-case nil (org-babel-script-escape result)
>
> On Sat 13 Jun 2020 at 17:19, Kyle Meyer <kyle@kyleam.com> wrote:
>
>> Ag Ibragimov writes:
>>
>>> M-x emacs-version and org-version report:
>>>
>>> GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101)) of 2020-06-07
>>> Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @ ~/.emacs.d/elpa/28.0/develop/org-plus-contrib-20200608/)
>>>
>>> Now I'm confused, what's in master of bzg/org-mode?
>>
>> It contains what will be the next feature release (9.4, at the moment).
>>
>> Notice that your reported version above contains a git revision: 706970.
>> If you look that up in the repo, you'll find that it's a few commits
>> back from the current tip of the maint branch.  The maint branch is the
>> source for the ELPA builds and is where bug fix releases are cut from.
>>
>>> And if someone wants to send patches, which branch it should be based
>>> of?
>>
>> Bug fixes that apply to maint should ideally be based off of maint, and
>> master is usually appropriate for everything else.


- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7rDs8UHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMWVQf/YlHZw3Yga3dTlLPU0Xg0f+tJ0JJR
oigjt4oOBsaMGshHny+4QBnO/QJTVWpYEm6j2oFp0Cb1CUn5TiTRDDyRVcX+I15u
W4T+UqsamKQQoRoJccPN3apraQlwiYbwLzN5Qy0hefOkj+E285PNf4Uq1VMwy9sL
n2zqY+cm+lrhv3wG08xXxWckg+Jx76s1M6j9QQH7nGNovYSl3YzpjtOPc2VE2ayv
8FQQX6PSH4gEW7ItyfYd18vYtIn65Zkum+L80d8+HtDVPkw0yDIq6uIkUbR5jCCY
tdbUsl6EeZlb9CkjY9WtOsIGe2FzIHjjhFSYvamgarqs5GGd+GazSPUVKQ==
=4JBP
-----END PGP SIGNATURE-----


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

end of thread, other threads:[~2020-06-18  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-13 21:58 Question on contributing to Org-mode Ag Ibragimov
2020-06-14  0:19 ` Kyle Meyer
2020-06-18  1:32   ` Ag Ibragimov
2020-06-18  6:50     ` stardiviner

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).