emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: Option to disable evaluation of code blocks during export [9.3.


From: Jeremie Juste
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]