emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-shell: consistent prefix


From: Ihor Radchenko
Subject: Re: [PATCH] ob-shell: consistent prefix
Date: Tue, 16 Jan 2024 13:12:11 +0000

Matt <matt@excalamus.com> writes:

> The attached patch makes names in ob-shell.el use the same prefix
> "org-babel-shell-" (along with a few similar minor consistency
> updates).
>
> Without the patch, three naming conventions exist:
>
> - org-babel-shell
> - org-babel-sh
> - ob-shell <----- that's my fault :)
> ...
> The  current "sh" names are generic and not specific to "/bin/sh" or
> something like the Bourne Shell.  The patch updates all "sh" names
> to "shell".

I do not mind changing the names, except that we must not break
backwards compatibility. In particular, the non-private function and
variable names that were present in the latest Org stable release must
be either supplied with an alias or declared obsolete. Otherwise, the
third-party code using the old names will be broken.

It is ok to change the variable names when the variables are introduced
within current main branch and not yet released.

Further, some function names are not arbitrary, but are instead dictated
by the rules ob-core.el demands from the babel backends. The following
variable and function names are special and must be named specifically
by babel backends:

- org-babel-default-header-args:<lang>
- org-babel-execute:<lang>
- org-babel-expand-body:<lang>
- org-babel-variable-assignments:<lang>
- org-babel-header-args:<lang>
- org-babel-load-session:<lang>
- org-babel-<lang>-initiate-session
- org-babel-prep-session:<lang>
- org-babel-edit-prep:<lang>
- org-babel-<lang>-associate-session

> -(defun org-babel-variable-assignments:shell (params)
> +(defun org-babel-shell-variable-assignments:shell (params)

This will break ob-shell as we change the expected function name from
the above list.

> -(defun org-babel-sh-initiate-session (&optional session _params)
> +(defun org-babel-shell-initiate-session (&optional session _params)

In theory, this should still work because `org-babel-shell-initialize'
create aliases to define multiple babel backends, for each shell name in
`org-babel-shell-names'. However, no alias is created for
`org-babel-<lang>-initiate-session' in particular, which is probably a
bug.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]