emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mario Frasca <mariotomo@gmail.com>
To: emacs-orgmode@gnu.org
Subject: better interaction with gnuplot-mode
Date: Sun, 02 Nov 2014 15:38:58 -0500	[thread overview]
Message-ID: <54569662.20302@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 928 bytes --]

a couple of weeks ago I decided I would use emacs for my spreadsheets. I
first tried with `ses`, then I was pointed at the spreadsheet
capabilities of org-mode. but I also needed to see a graph
representation of the data.

http://stackoverflow.com/questions/26614536/

tables in org-mode work really nice, but I wanted the resulting graph in
an emacs buffer, and in svg format. so I first ask the developer of
gnuplot-mode about it and we (well, actually _he_) came with a couple of
small edits that permit this.

https://github.com/bruceravel/gnuplot-mode/issues/20

during the process we found two spots in org-plot/gnuplot that we think
are in need of editing.

one is relative to the cleaning up of the temporary files.
the other is relative to killing (or not) the gnuplot process.

the patches are attached.

the discussion is in the issue:20 of
https://github.com/bruceravel/gnuplot-mode/

MF


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-correct-the-callback-for-the-and-register-it-as-soon.patch --]
[-- Type: text/x-patch; name="0002-correct-the-callback-for-the-and-register-it-as-soon.patch", Size: 1266 bytes --]

From be72bf875a9abd64869f1c0bd1c6ad50fa93e514 Mon Sep 17 00:00:00 2001
From: Mario Frasca <mrgsfrasca@gmail.com>
Date: Sun, 2 Nov 2014 08:53:27 -0500
Subject: [PATCH 2/2] correct the callback for the  and register it as soon as
 possible.

---
 lisp/org-plot.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 69d9250..faa34fc 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -294,6 +294,7 @@ line directly before or after the table."
 	   (table (org-table-to-lisp))
 	   (num-cols (length (if (eq (first table) 'hline) (second table)
 			       (first table)))))
+      (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (while (equal 'hline (first table)) (setf table (cdr table)))
       (when (equal (second table) 'hline)
 	(setf params (plist-put params :labels (first table))) ;; headers to labels
@@ -344,8 +345,7 @@ line directly before or after the table."
 	(gnuplot-mode)
 	(gnuplot-send-buffer-to-gnuplot))
       ;; cleanup
-      (bury-buffer (get-buffer "*gnuplot*"))
-      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
+      (bury-buffer (get-buffer "*gnuplot*")))))
 
 (provide 'org-plot)
 
-- 
1.9.1



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0001-do-not-kill-the-gnuplot-process.-just-jump-to-end-of.patch --]
[-- Type: text/x-patch; name="0001-do-not-kill-the-gnuplot-process.-just-jump-to-end-of.patch", Size: 897 bytes --]

From ebd2cd9b23138a39ad9ea4b517934c93757c2b4d Mon Sep 17 00:00:00 2001
From: Mario Frasca <mrgsfrasca@gmail.com>
Date: Sun, 2 Nov 2014 08:50:47 -0500
Subject: [PATCH 1/2] do not kill the gnuplot process. just jump to end of
 buffer and rely on  command to do the resetting job.

---
 lisp/org-plot.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 556b9ef..69d9250 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -281,8 +281,7 @@ line directly before or after the table."
     (delete-other-windows)
     (when (get-buffer "*gnuplot*") ;; reset *gnuplot* if it already running
       (with-current-buffer "*gnuplot*"
-	(goto-char (point-max))
-	(gnuplot-delchar-or-maybe-eof nil)))
+	(goto-char (point-max))))
     (org-plot/goto-nearest-table)
     ;; set default options
     (mapc
-- 
1.9.1



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

             reply	other threads:[~2014-11-02 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-02 20:38 Mario Frasca [this message]
2014-11-04 10:29 ` better interaction with gnuplot-mode Nicolas Goaziou
     [not found]   ` <5458C971.8010107@gmail.com>
     [not found]     ` <87y4rraskv.fsf@nicolasgoaziou.fr>
2014-11-08 15:16       ` Mario Frasca
2014-11-08 20:43         ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2014-11-02 14:15 Mario Frasca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54569662.20302@gmail.com \
    --to=mariotomo@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).