Function: org-babel-sh-initiate-session

org-babel-sh-initiate-session is a byte-compiled function defined in ob-shell.el.gz.

Signature

(org-babel-sh-initiate-session &optional SESSION PARAMS)

Documentation

Initiate a session named SESSION according to PARAMS.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-shell.el.gz
(defun org-babel-sh-initiate-session (&optional session _params)
  "Initiate a session named SESSION according to PARAMS."
  (when (and session (not (string= session "none")))
    (save-window-excursion
      (or (org-babel-comint-buffer-livep session)
          (progn
	    (shell session)
            ;; Set unique prompt for easier analysis of the output.
            (org-babel-comint-wait-for-output (current-buffer))
            (org-babel-comint-input-command
             (current-buffer)
             (format org-babel-prompt-command org-babel-sh-prompt))
            (setq-local comint-prompt-regexp
                        (concat "^" (regexp-quote org-babel-sh-prompt)
                                " *"))
	    ;; Needed for Emacs 23 since the marker is initially
	    ;; undefined and the filter functions try to use it without
	    ;; checking.
	    (set-marker comint-last-output-start (point))
	    (get-buffer (current-buffer)))))))