emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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

* 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

* Re: better interaction with gnuplot-mode
  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>
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-11-04 10:29 UTC (permalink / raw)
  To: Mario Frasca; +Cc: emacs-orgmode

Hello,

Mario Frasca <mariotomo@gmail.com> writes:

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

Thanks for your patches. Would you mind formatting your commit messages
according to the rules specified at

       http://orgmode.org/worg/org-contribute.html#unnumbered-10

> Subject: [PATCH 2/2] correct the callback for the  and register it as
                                                  ^^^^
Missing word.

> 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.
                    ^^^^
Ditto.


Regards,

-- 
Nicolas Goaziou

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

* Re: better interaction with gnuplot-mode
       [not found]     ` <87y4rraskv.fsf@nicolasgoaziou.fr>
@ 2014-11-08 15:16       ` Mario Frasca
  2014-11-08 20:43         ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Mario Frasca @ 2014-11-08 15:16 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

On 11/04/2014 10:33 AM, Nicolas Goaziou wrote:
> Mario Frasca <mariotomo@gmail.com> writes:
> 
>> being the comment in the subject field of an email, it can't be a
>> multiline comment, can it?
> 
> First line is a summary and cannot exceed 72 (or is it 68? I cannot
> remember) characters. You need to start with a capital but do not end
> with a period.

the output of the script I used to produce the patch was an email, the
ones I included. and my comment went into the subject of the email. I'm
afraid I still don't see how to specify a multi-line comment in the
subject of an email.

but we are circumventing it here, so let's see if I manage to respect
the orgmode rules...

-------------------------------------------------------------
Reset gnuplot process instead of killing it

TINYCHANGE. org-plot.el (org-plot/gnuplot): Without this patch, the
gnuplot process associated to the gnuplot buffer is killed before each
batch of instructions from orgmode to gnuplot. With or without this
patch, orgmode sends a reset instruction to the gnuplot process as first
instruction.

-------------------------------------------------------------
Correction in callback registration

TINYCHANGE org-plot.el (org-plot/gnuplot): The data-file variable is not
in the scope of the callback, one needs to grab its value while
registering the callback. With this patch the timer is set as soon as
the file is created. Without this patch the timer is set at the end of a
let-block, if anything goes wrong in the let-block before the timer is
set, the file will not be removed.
-------------------------------------------------------------



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

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

* Re: better interaction with gnuplot-mode
  2014-11-08 15:16       ` Mario Frasca
@ 2014-11-08 20:43         ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2014-11-08 20:43 UTC (permalink / raw)
  To: Mario Frasca; +Cc: emacs-orgmode

Mario Frasca <mariotomo@gmail.com> writes:

> but we are circumventing it here, so let's see if I manage to respect
> the orgmode rules...

Almost. TINYCHANGE should appear at the end of the commit message. Also,
sentences need to be separated by two spaces.

Anyway, I pushed your patches. Thanks for your work.

Regards,

^ permalink raw reply	[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).