Browse Source

customization variable prefix gnuplot code blocks

* lisp/ob-gnuplot.el (*org-babel-gnuplot-prefix*): Customization
  variable prefix gnuplot code blocks.
  (org-babel-expand-body:gnuplot): Customization variable prefix gnuplot
  code blocks.
Eric Schulte 4 years ago
parent
commit
7f05b315f5
1 changed files with 10 additions and 1 deletions
  1. 10 1
      lisp/ob-gnuplot.el

+ 10 - 1
lisp/ob-gnuplot.el

@@ -68,6 +68,13 @@
 
 (defvar *org-babel-gnuplot-missing* nil)
 
+(defcustom *org-babel-gnuplot-prefix* nil
+  "Optional prefix to send to gnuplot before the body of every code block.
+For example \"reset\" may be used to reset gnuplot between
+blocks."
+  :group 'org-babel
+  :type 'string)
+
 (defun org-babel-gnuplot-process-vars (params)
   "Extract variables from PARAMS and process the variables.
 Dumps all vectors into files and returns an association list
@@ -144,7 +151,9 @@ code."
       (mapc (lambda (pair)
 	      (setq body (replace-regexp-in-string
 			  (format "\\$%s" (car pair)) (cdr pair) body)))
-	    vars))
+	    vars)
+      (when *org-babel-gnuplot-prefix*
+	(funcall add-to-body *org-babel-gnuplot-prefix*)))
     body))
 
 (defun org-babel-execute:gnuplot (body params)