From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: [PATCH] org-plot: Handle explicit date/time index Date: Tue, 11 Mar 2014 02:26:47 +0900 Message-ID: <87ob1e2bin.wl@dns1.atmark-techno.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN4GZ-0000Jt-RX for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 13:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WN4GT-0001DY-Hm for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 13:45:31 -0400 Received: from p654782.hkidff01.ap.so-net.ne.jp ([121.101.71.130]:53492 helo=dns1.atmark-techno.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN4GT-0001Cp-8z for emacs-orgmode@gnu.org; Mon, 10 Mar 2014 13:45:25 -0400 Received: from sv-prius.atmark-techno.com (sv-prius.local-network [192.168.10.102]) by dns1.atmark-techno.com (Postfix) with ESMTP id 15CCE8358B for ; Tue, 11 Mar 2014 02:45:21 +0900 (JST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * lisp/org-plot.el (org-plot-quote-tsv-field): Dump data as is when `timeind' is set. * lisp/org-plot.el (org-plot/gnuplot): By-pass type checking when either `textind' or `timeind' is set. The current org-plot relies on `org-table-number-regexp' and `org-ts-regexp3' to check the index type. However, we already have `timeind' to indicate that the index is the datatype of date/time. By-pass the type checking in `org-plot/gnuplot' when either `textind' or `timeind' is set. The whole point of the check is to determine the type. We do not need that when we already know. Also dump the date/time data with `org-plot-quote-tsv-field' as is, without double quotes, when `timeind' is set. So that we can use `timefmt' to read what we have. Currently we do not have a good way to specify `timefmt' with the double quotes. --- Hi, It seems to me that dates with slash (ie. 2014/03/11) does not work with the current org-plot.el, even if you set `timeind' and `timefmt'. That's because the current org-plot treat "2014/03/11" as string instead of data/time. Here is an ECM: #+PLOT: ind:1 #+PLOT: timeind:t timefmt:"%Y/%m/%d" #+PLOT: set:"format x '%y-%m'" #+PLOT: set:"xtics rotate by -45" | 2014/03/11 | 0 | | 2014/03/12 | 1 | | 2014/03/13 | 2 | This patch fixes my itch but I'm not sure it doesn't break others. Could you please test it? and tell me how it works. BTW, do we have any test for org-plot? Let me know if there is any. Thanks, -- yashi lisp/org-plot.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 556b9ef..b5000ea 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -109,7 +109,8 @@ will be added. Returns the resulting property list." (defun org-plot-quote-tsv-field (s) "Quote field S for export to gnuplot." - (if (string-match org-table-number-regexp s) s + (if (or (string-match org-table-number-regexp s) + (plist-get params :timeind)) s (if (string-match org-ts-regexp3 s) (org-plot-quote-timestamp-field s) (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")))) @@ -312,7 +313,9 @@ line directly before or after the table." (when y-labels (plist-put params :ylabels y-labels))))) ;; check for timestamp ind column (let ((ind (- (plist-get params :ind) 1))) - (when (and (>= ind 0) (equal '2d (plist-get params :plot-type))) + (when (and (>= ind 0) (equal '2d (plist-get params :plot-type)) + (not (or (plist-get params :timeind) + (plist-get params :textind)))) (if (= (length (delq 0 (mapcar (lambda (el) -- 1.9.0