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*"))
	  (ess-ask-for-ess-directory
	   (and (bound-and-true-p ess-ask-for-ess-directory)
                (not (cdr (assq :dir params))))))
      (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))
          (require 'ess) (set-buffer (julia))
	  (rename-buffer
	   (if (bufferp session)
	       (buffer-name session)
	     (if (stringp session)
		 session
	       (buffer-name))))
	  (current-buffer))))))