On 25/07/2025 21:51, Ken Mankoff wrote:
Hi Max,
Reply-to does not include you in my mail client, only the list. I assume that's
intentional?
Sure, I am experimenting with the Mail-Followup-To header (it has some
downsides though).
On 2025-07-25 at 03:28 -07, Max Nikulin wrote...
ob-screen.el:78:8:Warning: ‘mapcar’ called for effect; use ‘mapc’ or
‘dolist’ instead
[...]
I forgot about this test warning. It remained. I've now fixed it.
Thank you.
My naive expectation is that it should be possible to just do
(intern-soft (format "org-babel-variable-assignments:%s" shell))
with single dash and
(funcall var-helper params)
This works for bash and sh, but I've also been testing with fish shell
where 'x="42"' is an error and the shell says "Please use 'set x 42'".
The current version, using internal org-babel--variable-assignments:%s
works in fish shell. I've added a comment. See attached patch.
Next attempt to reuse code
(let ((shell-file-name shell)
(var-helper (intern-soft (format
"org-babel-variable-assignments:%s" shell)))
(funcall var-helper params))
I admit it relies on implementation details, but I can not figure out
how to make org-babel-variable-assignments:... shell family more
straightforward.
Injecting :prologue before :var is also not something that should only
benefit screen, if it is even a benefit, but for some reason this
already works in 'normal' bash babel blocks.
I would prefer to not change semantics of :prologue for specific
org-babel languages. This kind of divergence may became source of
pitfalls for users and developers.
In addition it should allow non-standard executable names
:cmd /home/user/src/bash-9.99/bash-9.99
I just tried this and it is already supported.
Ether I missed something or it would not work for fish that needs
specific way for variable assignments while bash scalars are compatible
with the generic fallback approach.
#+begin_src screen :cmd ssh somewhere python :lang python :var a="test"
This more complicated :cmd is not supported. But can be achieved with :prologue
as shown above.
I do not see any complications with :lang
(let* ((cmd (alist-get :cmd params "sh"))
(lang (alist-get :lang params cmd))
(shell-file-name lang)
(var-helper
(intern-soft (format "org-babel-variable-assignments:%s" lang))))
(funcall var-helper params))
More complex :cmd requires some work, but it should avoid the kludge
with :prologue executed before variable assignment.
Ideally wrappers like ssh or screen should be available in a
TRAMP-like way for any babel language, but I do not have vision how to
properly implement it. With ob-screen it is not really convenient, but
should be easy to implement.
It's not clear yet what your vision is.
Certainly it is not clear, but I like your idea to derive some info from
:dir. I have no idea if somebody has tried to implement TRAMP backend
for screen.
- (if (string-match random-string tmp-string)
+ (if (string-match-p random-string tmp-string)
There is another case of `string-match', but it is there for ages, so it
may be fixed later.
+ (append (list terminal "-T" (concat "org-babel: " session) "-e")
+ (list org-babel-screen-location
+ "-c" screenrc
+ "-mS" session
+ cmd)))
Here cmd must be scalar. I am confused why you test it for list in
another function.
+ (shell (or (and cmd (if (listp cmd) (car cmd) cmd)) "sh"))
I expect uniform treatment.
+ (let* ((screen-cmd (format "%S -ls" org-babel-screen-location))
+ (screen-ls (shell-command-to-string screen-cmd))
Why you have changed it? Earlier you had a variant that allows shell
specials in screen path:
- (let* ((screen-ls (shell-command-to-string "screen -ls"))
+ (let* ((screen-ls (shell-command-to-string (concat (shell-quote-argument
org-babel-screen-location) " -ls")))