all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question regarding org-babel-eval and ob-erlang
@ 2024-08-24 19:18 Zelphir Kaltstahl
  2024-08-31 18:38 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Zelphir Kaltstahl @ 2024-08-24 19:18 UTC (permalink / raw)
  To: Org Mode List

Hello!

I have questions regarding `org-babel-eval'. Does `org-babel-eval' take into 
account the `PATH' or `exec-path' variables, when searching for 
executables/binaries to run source blocks?

More specifically in my experiments with `ob-erlang' it seems not to pick 
up/find binaries, which are in the first directory on the `PATH' and Emacs 
variable `exec-path'. `ob-erlang' calls `org-babel-eval' at 
https://github.com/xfwduke/ob-erlang/blob/a029c23902b4ad73b84f262a7fc5b98d87b63dfd/ob-erlang.el#L63-L68. 
That is how I came to `org-babel-eval'.

I am trying to get `ob-erlang' to work with an `emacs' and an `erlang' installed 
inside a guix profile. There is a repository, where I have a kind of example: 
https://codeberg.org/ZelphirKaltstahl/learn-you-some-erlang-workthrough/src/commit/daa84469286c05c9c4854c71e34f26b42da7b7c1. 
The readme has instructions of how I create a guix profile and in the following 
github issue of `ob-erlang' I describe my finding: 
https://github.com/xfwduke/ob-erlang/issues/1.

In short: Even though a directory `guix-profile/bin' is the first thing on the 
`PATH' and `exec-path' of Emacs, `org-babel-eval' does not seem to find `erlc' 
and `erl'.

What more do I need to do, in order to make org-babel find the Erlang executables?

Or is this a fault in `ob-erlang' and it shouldn't call `org-babel-eval' like that?

I see in the source code of org-mode, that `org-babel-eval' calls 
`org-babel--shell-command-on-region', but I failed to identify so far, where the 
portions of the code are, that are responsible for looking up binaries on the 
`PATH' directories.

I would like to create a merge request for `ob-erlang', fixing this behavior, 
possibly introducing a new defcustom, as someone mentioned in the above linked 
issue. I found the part where "erl" is in the code of `ob-erlang', but now I 
don't know how to proceed and whether it is really necessary, or there is a 
simple solution to make org-babel find the binaries on the `PATH' or `exec-path'.

My goal is to make the project self-contained. I do not want to install Erlang 
system-wide and hard-code `PATH' or similar things. I intentionally use guix 
profile to have things local in the project directory. I am using guix profile 
instead of guix shell, in order to have a predictable bin directory, that I can 
add to `PATH'.

Best regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl, https://codeberg.org/ZelphirKaltstahl



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

* Re: Question regarding org-babel-eval and ob-erlang
  2024-08-24 19:18 Question regarding org-babel-eval and ob-erlang Zelphir Kaltstahl
@ 2024-08-31 18:38 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-08-31 18:38 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: Org Mode List

Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

> I see in the source code of org-mode, that `org-babel-eval' calls 
> `org-babel--shell-command-on-region', but I failed to identify so far, where the 
> portions of the code are, that are responsible for looking up binaries on the 
> `PATH' directories.

In the nutshell, `org-babel--shell-command-on-region' does

</path/to/shell-file-name> -c <command>

You may try calling this from emacs via M-x shell-command
to investigate what is happening.

> I would like to create a merge request for `ob-erlang', fixing this behavior, 
> possibly introducing a new defcustom, as someone mentioned in the above linked 
> issue. I found the part where "erl" is in the code of `ob-erlang', but now I 
> don't know how to proceed and whether it is really necessary, or there is a 
> simple solution to make org-babel find the binaries on the `PATH' or `exec-path'.
>
> My goal is to make the project self-contained. I do not want to install Erlang 
> system-wide and hard-code `PATH' or similar things. I intentionally use guix 
> profile to have things local in the project directory. I am using guix profile 
> instead of guix shell, in order to have a predictable bin directory, that I can 
> add to `PATH'.

One way could be specifying full path to "erl", but I am not familiar
with ob-erlang and with Guix to suggest anything specific.

-- 
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] 2+ messages in thread

end of thread, other threads:[~2024-08-31 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 19:18 Question regarding org-babel-eval and ob-erlang Zelphir Kaltstahl
2024-08-31 18:38 ` 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.