Browse Source

still working on gnuplot variable support

Eric Schulte 16 years ago
parent
commit
307c7667db
2 changed files with 14 additions and 6 deletions
  1. 9 3
      lisp/langs/org-babel-gnuplot.el
  2. 5 3
      org-babel.org

+ 9 - 3
lisp/langs/org-babel-gnuplot.el

@@ -116,9 +116,15 @@ called by `org-babel-execute-src-block'."
 (defun org-babel-prep-session:gnuplot (session params)
   "Prepare SESSION according to the header arguments specified in PARAMS."
   (let* ((session (org-babel-gnuplot-initiate-session session))
-         (vars (org-babel-ref-variables params)))
-    
-    ))
+         (vars (org-babel-ref-variables params))
+         (var-lines (mapconc
+                     (lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair)))
+                     vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var-line)
+              (insert var-line) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)
+              (sit-for .1) (goto-char (point-max))) var-lines))))
 
 (defun org-babel-gnuplot-initiate-session (&optional session)
   "If there is not a current inferior-process-buffer in SESSION

+ 5 - 3
org-babel.org

@@ -2125,7 +2125,8 @@ plot data using 1:2 with lines
 **** DONE add variables
      gnuplot 4.2 and up support user defined variables.  This is how
      we will handle variables with org-babel (meaning we will need to
-     require gnuplot 4.2 and up for variable support).
+     require gnuplot 4.2 and up for variable support, which can be
+     install using [[http://www.macports.org/install.php][macports]] on Mac OSX).
 
      - scalar variables should be replaced in the body of the gnuplot code
      - vector variables should be exported to tab-separated files, and
@@ -2151,8 +2152,9 @@ there are a variety of helpers in org-plot which can be fit nicely
 into custom gnuplot header arguments
 
 **** TODO header argument specifying 3D data
-**** TODO gnuplot sessions
-Working on this, not sure how to rename a gnuplot session.
+**** STARTED gnuplot sessions
+Working on this, we won't support multiple sessions as `gnuplot-mode'
+isn't setup for such things.
 
 **** TODO gnuplot LoB functionality