emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* better interaction with gnuplot-mode
@ 2014-11-02 20:38 Mario Frasca
  2014-11-04 10:29 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Mario Frasca @ 2014-11-02 20:38 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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 --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* better interaction with gnuplot-mode
@ 2014-11-02 14:15 Mario Frasca
  0 siblings, 0 replies; 5+ messages in thread
From: Mario Frasca @ 2014-11-02 14:15 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 926 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: 1264 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: 895 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 --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-08 20:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-02 20:38 better interaction with gnuplot-mode Mario Frasca
2014-11-04 10:29 ` 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

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).