From: Aaron Ecay <aaronecay@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Add 'inline-only option to org-export-babel-evaluate
Date: Thu, 18 Apr 2013 04:24:10 -0400 [thread overview]
Message-ID: <874nf4s0ut.fsf@gmail.com> (raw)
In-Reply-To: <87bo9wr33z.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
Hi Eric,
2013ko apirilak 2an, Eric Schulte-ek idatzi zuen:
>
> I'm happy to apply this patch, however please also supply a patch which
> updates the corresponding documentation.
By “documentation” you mean the texinfo manual, right? Here is a new
version of this patch which also updates the manual.
[-- Attachment #2: 0001-Add-inline-only-option-to-org-export-babel-evaluate.patch --]
[-- Type: text/x-patch, Size: 3383 bytes --]
From 62ea51f473d387137b5294705241795d1d8bc39b Mon Sep 17 00:00:00 2001
From: Aaron Ecay <aaronecay@gmail.com>
Date: Sun, 31 Mar 2013 18:47:44 -0400
Subject: [PATCH] Add 'inline-only option to org-export-babel-evaluate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* lisp/ob-exp.el (org-export-babel-evaluate): Update defcustom to
provide 'inline-only option
(org-babel-exp-results): Implement 'inline-only for
org-export-babel-evaluate
* doc/org.texi (Exporting code blocks): Document ‘inline-only setting
for org-export-babel-evaluate
This is useful because there is no way for inline results to be stored.
The imagined usecase is that all non-inline source blocks will be
evaluated manually by the user. Inline blocks, however, must be
evaluated during export, or they will be simply deleted by the exporter.
---
doc/org.texi | 7 ++++++-
lisp/ob-exp.el | 11 ++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/doc/org.texi b/doc/org.texi
index b4a9d8f..f8f9c31 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -12928,7 +12928,12 @@ Setting the @code{org-export-babel-evaluate} variable to @code{nil} will
ensure that no code blocks are evaluated as part of the export process. This
can be useful in situations where potentially untrusted Org mode files are
exported in an automated fashion, for example when Org mode is used as the
-markup language for a wiki.
+markup language for a wiki. It is also possible to set this variable to
+@code{‘inline-only}. In that case, only inline code blocks will be
+evaluated, in order to insert their results. Non-inline code blocks are
+assumed to have their results already inserted in the buffer by manual
+evaluation. This setting is useful to avoid expensive recalculations during
+export, not to provide security.
@comment node-name, next, previous, up
@comment Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index e74b803..aa496d3 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -52,10 +52,13 @@
(defcustom org-export-babel-evaluate t
"Switch controlling code evaluation during export.
When set to nil no code will be evaluated as part of the export
-process."
+process. When set to 'inline-only, only inline code blocks will
+be executed."
:group 'org-babel
:version "24.1"
- :type 'boolean)
+ :type '(choice (const :tag "Never" nil)
+ (const :tag "Only inline code" inline-only)
+ (const :tag "Always" t)))
(put 'org-export-babel-evaluate 'safe-local-variable (lambda (x) (eq x nil)))
(defun org-babel-exp-get-export-buffer ()
@@ -378,7 +381,9 @@ Results are prepared in a manner suitable for export by org-mode.
This function is called by `org-babel-exp-do-export'. The code
block will be evaluated. Optional argument SILENT can be used to
inhibit insertion of results into the buffer."
- (when (and org-export-babel-evaluate
+ (when (and (or (eq org-export-babel-evaluate t)
+ (and (eq type 'inline)
+ (eq org-export-babel-evaluate 'inline-only)))
(not (and hash (equal hash (org-babel-current-result-hash)))))
(let ((lang (nth 0 info))
(body (if (org-babel-noweb-p (nth 2 info) :eval)
--
1.8.2.1
[-- Attachment #3: Type: text/plain, Size: 25 bytes --]
Thanks,
--
Aaron Ecay
next prev parent reply other threads:[~2013-04-18 8:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-01 5:44 [PATCH] Add 'inline-only option to org-export-babel-evaluate Aaron Ecay
2013-04-01 7:45 ` Nicolas Goaziou
2013-04-01 15:10 ` Aaron Ecay
2013-04-02 22:14 ` Eric Schulte
2013-04-18 8:24 ` Aaron Ecay [this message]
2013-04-18 8:44 ` Bastien
2013-04-18 9:19 ` Sebastien Vauban
2013-04-18 9:42 ` Aaron Ecay
2013-04-18 10:19 ` Sebastien Vauban
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874nf4s0ut.fsf@gmail.com \
--to=aaronecay@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.