[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel bloc
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks |
Date: |
Mon, 27 Feb 2023 19:43:06 +0000 |
Ken Mankoff <mankoff@gmail.com> writes:
>> To archive this, you can define a full
>> org-babel-variable-assignments:screen function that does what I
>> described.
>
> You're pushing my lisp skills here. Which is fine, but I might need some help.
>
> In ob-shell I see
>
> (defcustom org-babel-shell-names
> '("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh")
>
> Should I create a function that, using case statement or something similar,
> checks for each of these and calls that flavor? I think I could do that.
Not each of these. AFAIU, :cmd header property in ob-screen defines
which shell to use. Knowing shell name, you can deduce the function name
to be used for variable assignments. See how it is done in
`org-babel-expand-src-block'.
> But if I also see org-babel-shell-initialize in ob-shell that looks like it
> creates defaliases for each of these to (org-babel-execute:shell) and
> #'org-babel-variable-assignments:shell.
The convention is for every possible #+begin_src lang to have
org-babel-variable-assignments:LANG.
ob-shell just tries to avoid unnecessary code duplication and instead of
writing identical org-babel-variable-assignments:sh
org-babel-variable-assignments:bash, org-babel-variables-assignents:zsh,
..., it generates them using a macro.
> I'm not sure how that is very different from what I've done. I'm not sure
> what to do here, nor how to do what you suggest (yet - I've only read it so
> far, not spent a lot of time experimenting and searching, so I may be able to
> implement what I think is a solution to what you wrote, but I doubt it'll be
> what you expect).
AFAIU, you don't need to juggle with macros as ob-shell does. Something
similar to `org-babel-expand-src-block' will do.
--
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>
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, (continued)
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Max Nikulin, 2023/02/24
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ken Mankoff, 2023/02/25
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ken Mankoff, 2023/02/25
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Max Nikulin, 2023/02/25
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ken Mankoff, 2023/02/25
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Max Nikulin, 2023/02/26
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ken Mankoff, 2023/02/26
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ihor Radchenko, 2023/02/28
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ihor Radchenko, 2023/02/26
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks, Ken Mankoff, 2023/02/26
- Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks,
Ihor Radchenko <=