X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6a43ef8e8508df7d732e639ec75f657f4363e27a..2393085c9ac30ac7378a39ee77760dfdecd4b509:/lisp/org/ob-octave.el diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el index 9e8575768d..e0775dba3b 100644 --- a/lisp/org/ob-octave.el +++ b/lisp/org/ob-octave.el @@ -1,6 +1,6 @@ ;;; ob-octave.el --- org-babel functions for octave and matlab evaluation -;; Copyright (C) 2010-2012 Free Software Foundation, Inc. +;; Copyright (C) 2010-2015 Free Software Foundation, Inc. ;; Author: Dan Davison ;; Keywords: literate programming, reproducible research @@ -30,9 +30,6 @@ ;;; Code: (require 'ob) -(require 'ob-ref) -(require 'ob-comint) -(require 'ob-eval) (eval-when-compile (require 'cl)) (declare-function matlab-shell "ext:matlab-mode") @@ -52,7 +49,7 @@ to a non-nil value.") (defvar org-babel-matlab-emacs-link-wrapper-method - "%s + "%s if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid); else, save -ascii %s ans end @@ -110,7 +107,7 @@ end") (org-babel-prep-session:octave session params 'matlab)) (defun org-babel-variable-assignments:octave (params) - "Return list of octave statements assigning the block's variables" + "Return list of octave statements assigning the block's variables." (mapcar (lambda (pair) (format "%s=%s;" @@ -147,14 +144,15 @@ specifying a variable of the same value." (defun org-babel-matlab-initiate-session (&optional session params) "Create a matlab inferior process buffer. If there is not a current inferior-process-buffer in SESSION then -create. Return the initialized session." +create. Return the initialized session." (org-babel-octave-initiate-session session params 'matlab)) (defun org-babel-octave-initiate-session (&optional session params matlabp) "Create an octave inferior process buffer. If there is not a current inferior-process-buffer in SESSION then -create. Return the initialized session." - (if matlabp (require 'matlab) (require 'octave-inf)) +create. Return the initialized session." + (if matlabp (require 'matlab) (or (require 'octave-inf nil 'noerror) + (require 'octave))) (unless (string= session "none") (let ((session (or session (if matlabp "*Inferior Matlab*" "*Inferior Octave*")))) @@ -225,9 +223,9 @@ value of the last statement in BODY, as elisp." (message "Waiting for Matlab Emacs Link") (while (file-exists-p wait-file) (sit-for 0.01)) "")) ;; matlab-shell-run-region doesn't seem to - ;; make *matlab* buffer contents easily - ;; available, so :results output currently - ;; won't work + ;; make *matlab* buffer contents easily + ;; available, so :results output currently + ;; won't work (org-babel-comint-with-output (session (if matlabp @@ -265,7 +263,7 @@ This removes initial blank and comment lines and then calls (org-babel-import-elisp-from-file temp-file '(16)))) (defun org-babel-octave-read-string (string) - "Strip \\\"s from around octave string" + "Strip \\\"s from around octave string." (if (string-match "^\"\\([^\000]+\\)\"$" string) (match-string 1 string) string))