Function: org-babel-initiate-session
org-babel-initiate-session is an autoloaded, interactive and
byte-compiled function defined in ob-core.el.gz.
Signature
(org-babel-initiate-session &optional ARG INFO)
Documentation
Initiate session for current code block.
If called with a prefix argument then resolve any variable references in the header arguments and assign these variables in the session. Copy the body of the code block to the kill ring.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
;;;###autoload
(defun org-babel-initiate-session (&optional arg info)
"Initiate session for current code block.
If called with a prefix argument then resolve any variable
references in the header arguments and assign these variables in
the session. Copy the body of the code block to the kill ring."
(interactive "P")
(let* ((info (or info (org-babel-get-src-block-info (not arg))))
(lang (nth 0 info))
(body (nth 1 info))
(params (nth 2 info))
(session (cdr (assq :session params)))
(dir (cdr (assq :dir params)))
(default-directory
(or (and dir (file-name-as-directory dir)) default-directory))
(init-cmd (intern (format "org-babel-%s-initiate-session" lang)))
(prep-cmd (intern (concat "org-babel-prep-session:" lang))))
(when (and (stringp session) (string= session "none"))
(error "This block is not using a session!"))
(unless (fboundp init-cmd)
(error "No org-babel-initiate-session function for %s!" lang))
(with-temp-buffer (insert (org-trim body))
(copy-region-as-kill (point-min) (point-max)))
(when arg
(unless (fboundp prep-cmd)
(error "No org-babel-prep-session function for %s!" lang))
(funcall prep-cmd session params))
(funcall init-cmd session params)))