emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bjarte Johansen <bjarte.johansen@infomedia.uib.no>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Stop conversion of result on serialising to file
Date: Tue, 26 May 2015 13:11:44 +0200	[thread overview]
Message-ID: <99992A62-FF6D-4A83-90C8-C8B7FBB5AE03@infomedia.uib.no> (raw)

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


             reply	other threads:[~2015-05-26 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 11:11 Bjarte Johansen [this message]
2015-05-26 21:56 ` Stop conversion of result on serialising to file Nicolas Goaziou

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=99992A62-FF6D-4A83-90C8-C8B7FBB5AE03@infomedia.uib.no \
    --to=bjarte.johansen@infomedia.uib.no \
    --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).