]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-plot.el
Merge from emacs-23
[gnu-emacs] / lisp / org / org-plot.el
index c94dadb5998b257320879f047463278cfeef29cc..eea05716c33e28417140ffe73f643ece92c6e11c 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Keywords: tables, plotting
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 7.4
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -44,7 +44,7 @@
   '((:plot-type . 2d)
     (:with . lines)
     (:ind . 0))
-  "Default options to gnuplot used by `org-plot/gnuplot'")
+  "Default options to gnuplot used by `org-plot/gnuplot'.")
 
 (defvar org-plot-timestamp-fmt nil)
 
@@ -134,7 +134,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
 
 (defun org-plot/gnuplot-to-grid-data (table data-file params)
   "Export the data in TABLE to DATA-FILE for gnuplot.
-This means, in a format appropriate for grid plotting by gnuplot.
+This means in a format appropriate for grid plotting by gnuplot.
 PARAMS specifies which columns of TABLE should be plotted as independent
 and dependant variables."
   (interactive)
@@ -250,8 +250,9 @@ manner suitable for prepending to a user-specified script."
                 (setf plot-lines
                       (cons
                        (format plot-str data-file
-                               (or (and (not text-ind) ind
-                                        (> ind 0) (format "%d:" ind)) "")
+                               (or (and ind (> ind 0)
+                                         (not text-ind)
+                                         (format "%d:" ind)) "")
                                (+ 1 col)
                                (if text-ind (format ":xticlabel(%d)" ind) "")
                                with
@@ -271,7 +272,7 @@ manner suitable for prepending to a user-specified script."
 ;; facade functions
 ;;;###autoload
 (defun org-plot/gnuplot (&optional params)
-  "Plot table using gnuplot. Gnuplot options can be specified with PARAMS.
+  "Plot table using gnuplot.  Gnuplot options can be specified with PARAMS.
 If not given options will be taken from the +PLOT
 line directly before or after the table."
   (interactive)
@@ -300,7 +301,7 @@ line directly before or after the table."
        (setf table (delq 'hline (cdr table)))) ;; clean non-data from table
       ;; collect options
       (save-excursion (while (and (equal 0 (forward-line -1))
-                                 (looking-at "#\\+"))
+                                 (looking-at "[[:space:]]*#\\+"))
                        (setf params (org-plot/collect-options params))))
       ;; dump table to datafile (very different for grid)
       (case (plist-get params :plot-type)
@@ -320,7 +321,6 @@ line directly before or after the table."
                           (mapcar (lambda (row) (nth ind row)) table)))) 0)
              (plist-put params :timeind t)
            ;; check for text ind column
-
            (if (or (string= (plist-get params :with) "hist")
                    (> (length
                        (delq 0 (mapcar