0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:37:50 +00:00

babel: Allow EmacsLink to be used for matlab session evaluation

To use EmacsLink, the user will need to set
org-babel-matlab-with-emacs-link to a non-nil value, and also arrange
that (matlab-with-emacs-link) evaluates to a non-nil value.
This commit is contained in:
Dan Davison 2010-03-18 21:04:25 -04:00
parent 10a07a644b
commit 6f399c20b6
2 changed files with 17 additions and 3 deletions

View file

@ -50,6 +50,11 @@
(defun org-babel-expand-body:matlab (body params &optional processed-params) body)
(defvar org-babel-matlab-with-emacs-link nil
"If non-nil use matlab-shell-run-region for session
evaluation. This will use EmacsLink if (matlab-with-emacs-link)
evaluates to a non-nil value.")
(defun org-babel-execute:matlab (body params)
"Execute a block of matlab code with org-babel."
(org-babel-execute:octave body params 'matlab))

View file

@ -164,9 +164,18 @@ value of the last statement in BODY, as elisp."
(mapconcat
#'org-babel-chomp
(list (format org-babel-octave-wrapper-method body tmp-file tmp-file) org-babel-octave-eoe-indicator) "\n"))))
(raw (org-babel-comint-with-output session
(if matlabp org-babel-octave-eoe-indicator org-babel-octave-eoe-output) t
(insert full-body) (comint-send-input nil t))) results)
(raw (if (and matlabp org-babel-matlab-with-emacs-link)
(save-window-excursion
(with-temp-buffer
(insert full-body)
(matlab-shell-run-region (point-min) (point-max))
"")) ;; matlab-shell-run-region doesn't seem to
;; make *matlab* buffer contents easily
;; available, so :results output currently
;; won't work
(org-babel-comint-with-output session
(if matlabp org-babel-octave-eoe-indicator org-babel-octave-eoe-output) t
(insert full-body) (comint-send-input nil t)))) results)
(case result-type
(value
(org-babel-octave-import-elisp-from-file (org-babel-maybe-remote-file tmp-file)))