emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Stop conversion of result on serialising to file
@ 2015-05-26 11:11 Bjarte Johansen
  2015-05-26 21:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Bjarte Johansen @ 2015-05-26 11:11 UTC (permalink / raw)
  To: emacs-orgmode

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

When running a source block and storing the result in a file the data will first be converted to a table in org-babel-result-cond and then converted back to text when org-babel-execute-src-block writes it to file. This is takes a very long time when the result is big and it is unnecessary. I have attached a patch that makes org-babel-result-cond return the scalar result when it knows the result will be turned into a file.

Regards,
Bjarte


[-- Attachment #2: 0001-ob-core-Do-not-return-results-on-writing-to-file.patch --]
[-- Type: application/octet-stream, Size: 988 bytes --]

From 931dabfe93d9e78e1ee79664a0a555433956511d Mon Sep 17 00:00:00 2001
From: Bjarte Johansen <bjarte.johansen@gmail.com>
Date: Tue, 26 May 2015 12:54:14 +0200
Subject: [PATCH] ob-core: Do not return results on writing to file

When writing the result to file we do not need to first convert the
data to a table since it is just converted back when
org-babel-execute-src-block serializes the result to file.

* ob-core (org-babel-result-cond): Add "file" as a param that returns
  a scalar result.
---
 lisp/ob-core.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f4a8345..6821b6d 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2979,6 +2979,7 @@ Emacs shutdown."))
 		 (member "html" ,params)
 		 (member "code" ,params)
 		 (member "pp" ,params)
+		 (member "file" ,params)
 		 (and (or (member "output" ,params)
 			  (member "raw"    ,params)
 			  (member "org"    ,params)
-- 
2.3.2 (Apple Git-55)


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

* Re: Stop conversion of result on serialising to file
  2015-05-26 11:11 Stop conversion of result on serialising to file Bjarte Johansen
@ 2015-05-26 21:56 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2015-05-26 21:56 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

Hello,

Bjarte Johansen <bjarte.johansen@infomedia.uib.no> writes:

> When running a source block and storing the result in a file the data
> will first be converted to a table in org-babel-result-cond and then
> converted back to text when org-babel-execute-src-block writes it to
> file. This is takes a very long time when the result is big and it is
> unnecessary. I have attached a patch that makes org-babel-result-cond
> return the scalar result when it knows the result will be turned into
> a file.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-05-26 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26 11:11 Stop conversion of result on serialising to file Bjarte Johansen
2015-05-26 21:56 ` Nicolas Goaziou

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