diff options
Diffstat (limited to 'lisp/org/ob-gnuplot.el')
| -rw-r--r-- | lisp/org/ob-gnuplot.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 1acce502475..674627b8fa0 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el | |||
| @@ -116,6 +116,8 @@ code." | |||
| 116 | (timefmt (cdr (assq :timefmt params))) | 116 | (timefmt (cdr (assq :timefmt params))) |
| 117 | (time-ind (or (cdr (assq :timeind params)) | 117 | (time-ind (or (cdr (assq :timeind params)) |
| 118 | (when timefmt 1))) | 118 | (when timefmt 1))) |
| 119 | (directory (and (buffer-file-name) | ||
| 120 | (file-name-directory (buffer-file-name)))) | ||
| 119 | (add-to-body (lambda (text) (setq body (concat text "\n" body))))) | 121 | (add-to-body (lambda (text) (setq body (concat text "\n" body))))) |
| 120 | ;; append header argument settings to body | 122 | ;; append header argument settings to body |
| 121 | (when title (funcall add-to-body (format "set title '%s'" title))) | 123 | (when title (funcall add-to-body (format "set title '%s'" title))) |
| @@ -161,7 +163,10 @@ code." | |||
| 161 | (format "\\$%s" (car pair)) (cdr pair) body))) | 163 | (format "\\$%s" (car pair)) (cdr pair) body))) |
| 162 | vars) | 164 | vars) |
| 163 | (when prologue (funcall add-to-body prologue)) | 165 | (when prologue (funcall add-to-body prologue)) |
| 164 | (when epilogue (setq body (concat body "\n" epilogue)))) | 166 | (when epilogue (setq body (concat body "\n" epilogue))) |
| 167 | ;; Setting the directory needs to be done first so that | ||
| 168 | ;; subsequent 'output' directive goes to the right place. | ||
| 169 | (when directory (funcall add-to-body (format "cd '%s'" directory)))) | ||
| 165 | body)) | 170 | body)) |
| 166 | 171 | ||
| 167 | (defun org-babel-execute:gnuplot (body params) | 172 | (defun org-babel-execute:gnuplot (body params) |