emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ob-shell: consistent prefix
Date: Tue, 16 Jan 2024 13:12:11 +0000	[thread overview]
Message-ID: <87ttndl8wk.fsf@localhost> (raw)
In-Reply-To: <18d0ef7e532.10851f5ed1771823.3915352479016848501@excalamus.com>

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	other threads:[~2024-01-16 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 21:12 [PATCH] ob-shell: consistent prefix Matt
2024-01-16 13:12 ` Ihor Radchenko [this message]
2024-01-20 16:03   ` Matt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttndl8wk.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=matt@excalamus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).