Garid Zorigoo <[email protected]> writes:

> #+begin_src python :session (concat "a" "b")
> print("This code block's session name should be *ab*")
> #+end_src
>
> - Expected:
>   - Above block is executed in session called =*ab*=                 : great
>   - =M-x org-babel-load-in-session= loads into session called =*ab*= : great
> - Unexpected behavior:
>   - =M-x org-babel-initiate-session=   creates session named =*(concat "a"
> "b")*=
>   - =M-x org-babel-pop-to-session=       opens session named =*(concat "a"
> "b")*=
>   - =M-x org-babel-switch-to-session=    opens session named =*(concat "a"
> "b")*=

All the above is actually expected. `org-babel-initiate-session'
docstring says

    If called with a prefix argument ARG, then resolve any variable
    references in the header arguments and assign these variables in
    the session.

In other words, `org-babel-initiate-session', and, by reference,
`org-babel-pop-to-session' and `org-babel-switch-to-session' will not
evaluate header arguments by default. They will only do it with prefix
argument.

So, it is not a bug.
On the other hand, the current behavior is awkward (and also
inconsistent with org-edit-special).

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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