EP5W44GOTFS6UWWCOSBAXZNVH44J6YZ2EAO6EKUEQVFEATIVAM5AC
'((:buffer . "*ob-term*")
'((:session . "*ob-term*")
;; The value of `:create' must be a list of a function and its
;; arguments. As the first argument the buffer-name (from the
;; `:session' parameter) will be spliced into the list. You can
;; provide your own function but make sure that they adhere to
;; this convention. See the functions `ob-term-term',
;; `ob-term-serial-term' and `ob-term-comint' as an example.
(if (cdr (assoc :create params))
(eval (cdr (assoc :create params)))
(error "buffer '%s' not found and no create function specified" buffer)))
(let ((form (cdr (assoc :create params))))
(if form
(apply (car form) buffer (cdr form))
(error "buffer '%s' not found and no create function specified" buffer))))
(let ((buf (make-term (or buffer-name program) program)))
(with-current-buffer buf
(term-mode)
(term-char-mode))
(let ((buf (get-buffer-create buffer-name)))
(unless (term-check-proc buf)
(with-current-buffer buf
(term-mode)
(term-exec buf buffer-name program nil args)
(term-char-mode)))
(cl-letf (((symbol-function 'pop-to-buffer-same-window) #'pop-to-buffer))
(let ((explicit-shell-file-name program)
(prevbuf (current-buffer)))
(shell (or buffer-name (format "*%s*" program)))
(pop-to-buffer prevbuf))))
(apply #'make-comint-in-buffer buffer-name buffer-name program nil args)
(display-buffer buffer-name))
** a shell in comint-mode
#+header: :create '(ob-term-shell "bash" "*shell*")
#+header: :buffer *shell*
** A shell in comint-mode
#+header: :create '(ob-term-comint "bash")
#+header: :session *comint-bash*
** Windows Subsystem for Linux (wsl) bash in comint-mode
#+header: :create '(ob-term-comint "wsl" "bash")
#+header: :session *comint-wsl-bash*
#+begin_src term:sh :results silent
PS1=""
echo ""
#+end_src
#+header: :session *comint-wsl-bash*
#+begin_src term:sh
uname -a
#+end_src