emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jeremie Juste <jeremiejuste@gmail.com>
To: John Ciolfi <ciolfi@mathworks.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Bug: Option to disable evaluation of code blocks during export [9.3.7 (9.3.7-dist @ /PATH/TO/org/install/emacs/site-lisp/org/)]
Date: Sat, 13 Jun 2020 14:22:19 +0200	[thread overview]
Message-ID: <87sgezdukk.fsf@gmail.com> (raw)
In-Reply-To: <87imfvguxw.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Sat, 13 Jun 2020 11:46:03 +0200")


Hello,

I understand the frustration of not being able to bend emacs to ones
immediately. But many times my initial workflow turned out not to be the
best one. I just wanted to share my workflow hoping that it might be a solution to
the original post problem.

>> Consider the scenario where a number of people are working on a common
>> overall "book" which is constructed from many org-files. The
>> "hardcoded" setting of :eval no-export header in individual blocks
>> would mean that I cannot interactively enable or disable the
>> evaluation of the blocks.

At some point, I experienced the same problem and as the document get
larger and larger it tends to complicate the management of code block
evaluation. I have found two solutions to this problem using existing
org-mode features.

* First
use global property header :eval yes, but evaluate only the sub-tree of
interest when the need comes. For a book it might be a part, a chapter
(even a paragraph by artificially creating a sub-tree at the desired
point). In that way you have only one trigger to push to disable
evaluation for the entire document.

To makes things quicker one can define a way to  change :eval
from yes to no very quickly. (I use point registers for this purpose
(info "(emacs) Registers"), but you could imagine a function with
key-bindings)


* Second

The second solution could be to use checkpoints with cache for
instance. Let say that, one wants to work on Part 1 only and wants to
evaluate code just for this part then. The following work flow might be suitable.

* Part 1
  :PROPERTIES:
  :header-args: :eval yes :cache yes
  :END:

#+BEGIN_SRC matlab
A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1]
#+END_SRC

 ** strip the header row
 #+BEGIN_SRC matlab
 A = [1 ; 2],  B = A.', C = transpose(A)
 #+END_SRC


* Part 2
  :PROPERTIES:
  :header-args: :eval no :cache yes
  :END:

#+BEGIN_SRC matlab
ones(3,3)
#+END_SRC

HTH,

Jeremie




      reply	other threads:[~2020-06-13 12:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 19:55 Bug: Option to disable evaluation of code blocks during export [9.3.7 (9.3.7-dist @ /PATH/TO/org/install/emacs/site-lisp/org/)] John Ciolfi
2020-06-11 21:28 ` Nicolas Goaziou
2020-06-11 21:57   ` John Ciolfi
2020-06-12  8:51     ` Nicolas Goaziou
2020-06-12 14:32       ` John Ciolfi
2020-06-13  9:46         ` Nicolas Goaziou
2020-06-13 12:22           ` Jeremie Juste [this message]

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=87sgezdukk.fsf@gmail.com \
    --to=jeremiejuste@gmail.com \
    --cc=ciolfi@mathworks.com \
    --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).