* Thoughts on this ob language generator
@ 2023-01-14 2:11 George Mauer
2023-01-15 1:34 ` Tim Cross
2023-01-18 12:11 ` Ihor Radchenko
0 siblings, 2 replies; 4+ messages in thread
From: George Mauer @ 2023-01-14 2:11 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 860 bytes --]
I had a need the other day to execute some typescript in an org document.
Now I know that there's an ob-typescript package but that doesn't quite
work the way I want and expects typescript to be installed globally (which
runs into a variety of versioning issues).
There is a better option available with the `npx` program (installed
alongside `npm`) which can install a package along with its dependencies
into a temporary sandbox and run its binaries.
I rewrote the typescript babel plugin to do this and then realized that
there was relatively little in it beyond variable and function names that
was typescript-specific. The exact same process can be used for anything
that has an interpreter up on npm. Coffeescript, mermaidjs, all sorts of
things.
So I made a macro. I'm interested what people here think:
https://github.com/togakangaroo/create-ob-npx
[-- Attachment #2: Type: text/html, Size: 974 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Thoughts on this ob language generator
2023-01-14 2:11 Thoughts on this ob language generator George Mauer
@ 2023-01-15 1:34 ` Tim Cross
2023-01-15 4:00 ` George Mauer
2023-01-18 12:11 ` Ihor Radchenko
1 sibling, 1 reply; 4+ messages in thread
From: Tim Cross @ 2023-01-15 1:34 UTC (permalink / raw)
To: emacs-orgmode
George Mauer <gmauer@gmail.com> writes:
> I had a need the other day to execute some typescript in an org document. Now I know that there's an
> ob-typescript package but that doesn't quite work the way I want and expects typescript to be installed
> globally (which runs into a variety of versioning issues).
>
> There is a better option available with the `npx` program (installed alongside `npm`) which can install a
> package along with its dependencies into a temporary sandbox and run its binaries.
>
> I rewrote the typescript babel plugin to do this and then realized that there was relatively little in it
> beyond variable and function names that was typescript-specific. The exact same process can be used for
> anything that has an interpreter up on npm. Coffeescript, mermaidjs, all sorts of things.
>
> So I made a macro. I'm interested what people here think: https://github.com/togakangaroo/create-ob-npx
This looks interesting and could have some great potential. As you say,
tehre is a growing class of languages which could be supported using
this method. I'm interested in trying out the nbb package (Clojurescript
on node) using this method, but right now, no time.
Really just wanted to give feedbac as I noticed nobody else responded
and didn't want to give the impression there was no interest.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Thoughts on this ob language generator
2023-01-15 1:34 ` Tim Cross
@ 2023-01-15 4:00 ` George Mauer
0 siblings, 0 replies; 4+ messages in thread
From: George Mauer @ 2023-01-15 4:00 UTC (permalink / raw)
To: Tim Cross; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]
Thanks a lot Tim, I really appreciate you responding (as you said, it can
be discouraging to not get any response)
For the record, I just tried this simple example and it works
#+begin_src emacs-lisp :results silent
(create-ob-npx :name "ob-nbb"
:language "clojurescript"
:npx-arguments "nbb")
#+end_src
#+begin_src clojurescript
(prn (+ 1 2 3))
#+end_src
#+RESULTS:
: 6
Never pushed anything to MELPA before but will have to take a look at how
to do this.
On Sat, Jan 14, 2023 at 7:41 PM Tim Cross <theophilusx@gmail.com> wrote:
> George Mauer <gmauer@gmail.com> writes:
>
> > I had a need the other day to execute some typescript in an org
> document. Now I know that there's an
> > ob-typescript package but that doesn't quite work the way I want and
> expects typescript to be installed
> > globally (which runs into a variety of versioning issues).
> >
> > There is a better option available with the `npx` program (installed
> alongside `npm`) which can install a
> > package along with its dependencies into a temporary sandbox and run its
> binaries.
> >
> > I rewrote the typescript babel plugin to do this and then realized that
> there was relatively little in it
> > beyond variable and function names that was typescript-specific. The
> exact same process can be used for
> > anything that has an interpreter up on npm. Coffeescript, mermaidjs, all
> sorts of things.
> >
> > So I made a macro. I'm interested what people here think:
> https://github.com/togakangaroo/create-ob-npx
>
> This looks interesting and could have some great potential. As you say,
> tehre is a growing class of languages which could be supported using
> this method. I'm interested in trying out the nbb package (Clojurescript
> on node) using this method, but right now, no time.
>
> Really just wanted to give feedbac as I noticed nobody else responded
> and didn't want to give the impression there was no interest.
>
>
[-- Attachment #2: Type: text/html, Size: 2662 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Thoughts on this ob language generator
2023-01-14 2:11 Thoughts on this ob language generator George Mauer
2023-01-15 1:34 ` Tim Cross
@ 2023-01-18 12:11 ` Ihor Radchenko
1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2023-01-18 12:11 UTC (permalink / raw)
To: gmauer; +Cc: emacs-orgmode
George Mauer <gmauer@gmail.com> writes:
> I had a need the other day to execute some typescript in an org document.
> Now I know that there's an ob-typescript package but that doesn't quite
> work the way I want and expects typescript to be installed globally (which
> runs into a variety of versioning issues).
>
> There is a better option available with the `npx` program (installed
> alongside `npm`) which can install a package along with its dependencies
> into a temporary sandbox and run its binaries.
>
> I rewrote the typescript babel plugin to do this and then realized that
> there was relatively little in it beyond variable and function names that
> was typescript-specific. The exact same process can be used for anything
> that has an interpreter up on npm. Coffeescript, mermaidjs, all sorts of
> things.
>
> So I made a macro. I'm interested what people here think:
> https://github.com/togakangaroo/create-ob-npx
I'd say that the problem you are trying to solve is similar to what
ob-shell.el does. And it does it similarly, modulo common shell syntax.
More generally, generic backends like ob-shell or what you are proposing
are a subset of "take the code block, save it to file, and pass the file
to be executed by a CLI command".
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-18 12:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-14 2:11 Thoughts on this ob language generator George Mauer
2023-01-15 1:34 ` Tim Cross
2023-01-15 4:00 ` George Mauer
2023-01-18 12:11 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.