org-babel-gnuplot: variable expansion in gnuplot source-code with '$' character
Variable names in gnuplot source code preceded by the '$' character will be expanded to their value before the code is executed. For example the following will results in the evaluation of 'plot sin(x)' by gnuplot. "sin(x)" plot $fun
This commit is contained in:
parent
87fc0b0e2c
commit
0969873888
|
@ -120,6 +120,12 @@ called by `org-babel-execute-src-block'."
|
|||
(add-to-body (mapconcat
|
||||
(lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair)))
|
||||
vars "\n"))
|
||||
;; replace any variable names preceded by '$' with the actual
|
||||
;; value of the variable
|
||||
(mapc (lambda (pair)
|
||||
(setq body (replace-regexp-in-string
|
||||
(format "\\$%s" (car pair)) (cdr pair) body)))
|
||||
vars)
|
||||
;; evaluate the code body with gnuplot
|
||||
(if (string= session "none")
|
||||
(let ((script-file (make-temp-file "org-babel-gnuplot-script")))
|
||||
|
|
Loading…
Reference in New Issue