Function: org-babel-julia-initiate-session

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

Signature

(org-babel-julia-initiate-session SESSION PARAMS)

Documentation

If there is not a current julia process then create one.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-julia.el.gz
(defvar ess-ask-for-ess-directory) ; dynamically scoped
(defun org-babel-julia-initiate-session (session _params)
  "If there is not a current julia process then create one."
  (unless (string= session "none")
    (let* ((session (or session "*Julia*"))
           ;; Force using `default-directory', as we promise in the
           ;; manual.  The caller should have taken care about setting
           ;; it according to :dir if necessary.
           ;; https://ess.r-project.org/Manual/ess.html#Changing-the-startup-actions
	   (ess-ask-for-ess-directory nil)
           (ess-directory-function nil)
           (ess-directory nil)
           ;; Make ESS name the process buffer as SESSION.
           (ess-gen-proc-buffer-name-function
            (lambda (_) session)))
      (if (org-babel-comint-buffer-livep session)
	  session
	;; FIXME: Depending on `display-buffer-alist', (julia) may end up
        ;; popping up a new frame which `save-window-excursion' won't be able
        ;; to "undo", so we really should call a kind of
        ;; `julia-no-select' instead so we don't need to undo any
        ;; window-changes afterwards.
	(save-window-excursion
	  (when (get-buffer session)
	    ;; Session buffer exists, but with dead process
	    (set-buffer session))
          (org-require-package 'ess "ESS")
          (set-buffer (julia))
	  (current-buffer))))))