diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-10-02 14:27:55 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-10-02 14:41:27 -0400 |
commit | bb209cd5ab819c72784de7278092705e59ff41d5 (patch) | |
tree | e169d918d7090a10a8e30bf0ff9e914cc9d2d733 /lisp/org/ob-julia.el | |
parent | 4341e79a5fad3e5e668a3eeb1b688d1986011481 (diff) | |
download | emacs-bb209cd5ab819c72784de7278092705e59ff41d5.tar.gz emacs-bb209cd5ab819c72784de7278092705e59ff41d5.tar.bz2 emacs-bb209cd5ab819c72784de7278092705e59ff41d5.zip |
Update to Org 9.5-30-g10dc9d
The plan is to cut the Org 9.5.1 release and include it in Emacs 28.1,
but in the meantime regularly sync changes from Org's bugfix branch to
emacs-28.
This sync includes files from Org 9.5's new etc/csl/ directory that
should have been synced in bf9ec3d91a (Update to Org 9.5, 2021-09-29).
Diffstat (limited to 'lisp/org/ob-julia.el')
-rw-r--r-- | lisp/org/ob-julia.el | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 434b414b614..4fae0d142b2 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -90,18 +90,13 @@ This function is called by `org-babel-execute-src-block'." (graphics-file (and (member "graphics" (assq :result-params params)) (org-babel-graphical-output-file params))) (colnames-p (unless graphics-file (cdr (assq :colnames params)))) - ;; (rownames-p (unless graphics-file (cdr (assq :rownames params)))) (full-body (org-babel-expand-body:julia body params graphics-file)) (result (org-babel-julia-evaluate session full-body result-type result-params (or (equal "yes" colnames-p) (org-babel-pick-name - (cdr (assq :colname-names params)) colnames-p)) - ;; (or (equal "yes" rownames-p) - ;; (org-babel-pick-name - ;; (cdr (assq :rowname-names params)) rownames-p)) - ))) + (cdr (assq :colname-names params)) colnames-p))))) (if graphics-file nil result)))) (defun org-babel-normalize-newline (result) @@ -135,12 +130,7 @@ This function is called by `org-babel-execute-src-block'." "Return list of julia statements assigning the block's variables." (let ((vars (org-babel--get-vars params))) (mapcar - (lambda (pair) - (org-babel-julia-assign-elisp - (car pair) (cdr pair) - ;; (equal "yes" (cdr (assq :colnames params))) - ;; (equal "yes" (cdr (assq :rownames params))) - )) + (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair))) (mapcar (lambda (i) (cons (car (nth i vars)) @@ -156,7 +146,7 @@ This function is called by `org-babel-execute-src-block'." (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") (format "%S" s))) -(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p +(defun org-babel-julia-assign-elisp (name value) "Construct julia code assigning the elisp VALUE to a variable named NAME." (if (listp value) (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) @@ -164,11 +154,7 @@ This function is called by `org-babel-execute-src-block'." (min (if lengths (apply #'min lengths) 0))) ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) - (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) - ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p) - ;; "TRUE" "FALSE")) - ;; (row-names (if rownames-p "1" "NULL")) - ) + (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field)))) (if (= max min) (format "%s = begin using CSV @@ -188,7 +174,7 @@ end" (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)))))) + (not (cdr (assq :dir params)))))) (if (org-babel-comint-buffer-livep session) session ;; FIXME: Depending on `display-buffer-alist', (julia) may end up @@ -209,14 +195,6 @@ end" (buffer-name)))) (current-buffer)))))) - ; (defun org-babel-julia-associate-session (session) - ; "Associate julia code buffer with a julia session. - ; Make SESSION be the inferior ESS process associated with the - ; current code buffer." - ; (setq ess-local-process-name - ; (process-name (get-buffer-process session))) - ; (ess-make-buffer-current)) - (defun org-babel-julia-graphical-output-file (params) "Name of file to which julia should send graphical output." (and (member "graphics" (cdr (assq :result-params params))) @@ -259,16 +237,16 @@ end" end") (defun org-babel-julia-evaluate - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate julia code in BODY." (if session (org-babel-julia-evaluate-session - session body result-type result-params column-names-p) ;; row-names-p + session body result-type result-params column-names-p) (org-babel-julia-evaluate-external-process - body result-type result-params column-names-p))) ;; row-names-p + body result-type result-params column-names-p))) (defun org-babel-julia-evaluate-external-process - (body result-type result-params column-names-p) ;; row-names-p + (body result-type result-params column-names-p) "Evaluate BODY in external julia process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -292,7 +270,7 @@ last statement in BODY, as elisp." (output (org-babel-eval org-babel-julia-command body)))) (defun org-babel-julia-evaluate-session - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the |