From 26c09d431030bacfc5a4ce84103b2eca186b2229 Mon Sep 17 00:00:00 2001 From: TEC Date: Thu, 9 Jul 2020 05:00:03 +0800 Subject: [PATCH 06/15] org-plot.el: add custom var for affecting the term * lisp/org-plot.el (org-plot/gnuplot-script): Allow for customisation of org-plot's term by adding a custom variable `org-plot/gnuplot-term-extra' which allows the user to tweak the gnuplot term settings. This allows for setting characteristics such as default size, or background colour. --- lisp/org-plot.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 2a9c0f5bd..ed4cea195 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -331,6 +331,13 @@ that function. i.e. it is called with the following arguments: :group 'org-plot :type '(alist :value-type (symbol group))) +(defcustom org-plot/gnuplot-term-extra "" + "String or function which provides the extra term options. +E.g. a value of \"size 1050,650\" would cause +\"set term ... size 1050,650\" to be used." + :group 'org-plot + :type '(choice string function)) + (defun org-plot/gnuplot-script (data-file num-cols params &optional preface) "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS. NUM-COLS controls the number of columns plotted in a 2-d plot. @@ -360,8 +367,15 @@ manner suitable for prepending to a user-specified script." ;; ats = add-to-script (ats (lambda (line) (setf script (concat script "\n" line)))) plot-lines) - (when file ; output file - (funcall ats (format "set term %s" (file-name-extension file))) + + + ;; handle output file, background, and size + (funcall ats (format "set term %s %s" + (if file (file-name-extension file) "GNUTERM") + (if (stringp org-plot/gnuplot-term-extra) + org-plot/gnuplot-term-extra + (org-plot/gnuplot-term-extra)))) + (when file ; output file (funcall ats (format "set output '%s'" file))) (funcall ats -- 2.28.0