Browse Source

smarter gnuplot file extension to terminal mapping
* lisp/ob-gnuplot.el (*org-babel-gnuplot-terms*): Smarter gnuplot file
extension to terminal mapping.
(org-babel-expand-body:gnuplot): Smarter gnuplot file extension to
terminal mapping.

Eric Schulte 11 years ago
parent
commit
c5cc342e1c
1 changed files with 12 additions and 1 deletions
  1. 12 1
      lisp/ob-gnuplot.el

+ 12 - 1
lisp/ob-gnuplot.el

@@ -75,6 +75,13 @@ blocks."
   :group 'org-babel
   :type 'string)
 
+(defcustom *org-babel-gnuplot-terms*
+  '((eps . "postscript eps"))
+  "List of file extensions and the associated gnuplot terminal."
+  :group 'org-babel
+  :type '(repeat (cons (symbol :tag "File extension")
+		       (string :tag "Gnuplot terminal"))))
+
 (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
@@ -97,7 +104,11 @@ code."
     (let* ((vars (org-babel-gnuplot-process-vars params))
            (out-file (cdr (assoc :file params)))
            (term (or (cdr (assoc :term params))
-                     (when out-file (file-name-extension out-file))))
+                     (when out-file
+		       (let ((ext (file-name-extension out-file)))
+			 (or (cdr (assoc (intern (downcase ext))
+					 *org-babel-gnuplot-terms*))
+			     ext)))))
            (cmdline (cdr (assoc :cmdline params)))
            (title (cdr (assoc :title params)))
            (lines (cdr (assoc :line params)))