I think this problem is caused by the change of org-babel-check-confirm-evaluate from a macro to a function. If you have org-mode (and thus the old macro) loaded when you compile the new code, it sees the old macro instead of the new function.
As others have pointed out uninstalling org-mode restarting Emacs (without loading org-mode) and reinstalling will ...
Below you find an :override advice for org-babel-tangle-collect-blocks of org-mode 9.1.6 that allows lists of tangle file names instead of just one tangle file name.
The code of the advice is largely a copy of org-babel-tangle-collect-blocks. Only the lines marked with Tobias are modified or added.
That would make the modification a good pull request if ...
The following elisp code defines a new function org-babel-tangle-append appending the current source block to the tangle file.
In org-mode 9.1.6 there is no user option to configure org-babel-tangle in that way.
If you copy-paste the full elisp code into your init file behind package-initialize the new function org-babel-tangle-append is bound to the key ...
For literate programming, revise the existing tangle block and rely on your version control system to maintain the history.
The examples you're referring to sound more like engineering notebooks / journals where the author is keeping a record of activities performed. While I highly recommend keeping an engineering notebook, keeping a lot of dead code ...
You can try the command list-org-src from the following elisp code.
It is tested with emacs 25.3.1 and org-mode 9.1.6.
Install the source in your init file (after (package-initialize)).
Open your org file and type M-x list-org-src RET.
That creates an org-src buffer with a tabulated list of the source code block entries. Each entry has the following ...
In my emacs 25.1.1. + org version 9.0.4 the tangled a.out file correctly contains
echo "value = " $value
I have used these kind of functions and tangling extensively and for a long time, so I can only guess that you may be running a very old version of org mode. Try to update it from http://orgmode.org/elpa/ using the package manager.
The noweb approach is built in to Org-mode but I believe it is a bit clumsy for your purpose. Therewith you can substitute marked names in source blocks with their result values within a source block. Thereby, the names are themselves names of source blocks that are evaluated to get the results.
Applied to your example that could look like ...
On Emacs 25.2 (9.0) and using org-plus-contrib:
org-babel-execute-src-block gave me the same error as C-c C-c
deleting the .emacs.d/elpa folder and reinstalling did not fix it
but M-x package-delete [RET] org-plus-contrib and reinstalling with M-x package-install [RET] org-plus-contrib DID fix it
I recommend using the builtin org-mode :noweb-ref header to concatenate the code blocks because doing so will resolve the block tangling issue and will allow more flexibility in the future.
* config file
#+BEGIN_SRC clojure :noweb yes :exports none :mkdirp yes :tangle data/code/tangle-append-test.clj
What I do is I specify a single block per output file, and use noweb references to collect what goes into it:
Here are the blocks with the source you want:
I understand your confusion.
The good news is that your code is already passing new lines correctly into your noweb call.
The reason you're seeing the eval: Symbol’s value as variable is void: a error is because of the generated elisp code.
If you execute the following code you'll see the same error message:
I think you're asking how to prefix only the first line of the noweb block. It will probably depend on the language your using, but I came up with this hack for bash:
please echo this line
date ## but not this one
cd test ## this one
ls -l ## or this one
Bad source code block, echo prepended to very line:
In the original org-babel-tangle function (C-h k org-babel-tangle), found in ob-tangle.el, a space is inserted between two lines unless the argument to :padline is no:
;; Handle :padlines unless first line in file
(unless (or (string= "no" (cdr (assq :padline (nth 4 spec))))
(= (point) (point-min)))
Short Answer - Update the original code block and tangle again.
Adding the same :tangle header to separate code blocks will concatenate the code when tangling the entire buffer with C-c C-v t but will only tangle the current code block into the file if C-u C-c C-v t is used. This behavior can be confusing when tangling.
In your use case, you created a ...
For navigation and symbol definition see https://github.com/jkitchin/scimax/blob/master/scimax-literate-programming.el
You can generate a TAGS file with M-x scimax-lp-generate-tags.
After this, I can navigate to function definitions with M-. and M-,. You need to refresh the TAGS file with that function as things move around and get added, but maybe that ...
Here's what Nick Dokos (who has helped me often) over at the org-mode mail list says:
...tangling does not run code blocks: it just writes them out to (one
or many) different file(s). org-babel-load-file calls
org-babel-tangle which is an autoloaded function, so when it is
called, emacs arranges to load the file that defines it (i.e.
Define a new function in elisp using Org Element API to that returns :title property of headline element.
For this answer, I wrote a headline-title function that returns the :title of the nearest headline above the SRC block.
Byte-compiling is a CPU-bound activity, unlike with subprocesses and network processes there is no way of doing it asynchronously in the same Emacs instance. What you can do though is launching an Emacs subprocess and making it byte-compile the file. async.el offers support for this, try async-byte-compile-file from async-bytecomp.el.
I don't see a clever way to do what you want: you would have to change the org-babel-tangle function itself, or rather write your own function which would be almost the same as the org-babel-tangle function, but not quite. @Tobias's answer in the linked question locally redefines the delete-file function to ignore, so when org-babel-tangle is called, the ...
Partial answer: this does it and reduces tangling time by about 40% (subjective). But I'm looking for more ways to speed it up. Compared to eg the C preprocessor cpp, org-tangle is very slow.
(defadvice org-babel-tangle-single-block (around inhibit-redisplay activate protect compile)
"inhibit-redisplay and inhibit-message to avoid flicker."
The way I configured my init.el as a init.org is similar to the one you are quoting from Uncle Dave. I am not using ob-tangle for parsing all the src blocks to another file using :tangle as a argument. I just bind org-babel-load-file to a key so as to reload it whenI make changes.
(global-set-key (kbd "C-c i")
(lambda() (interactive)(org-babel-load-file "~/...
One idea is to make copies of the blocks as you go along.
But remove the :tangle app/views/layouts/application.html.erb
part from the older block(s). So the tangling is done once when
pressing C-c v t. This does mean that your coolsite.org file
builds up a lot of dead code. For some folks (I'm undecided atm)
dead code can be actually useful history, it's ...
I address here only the following part of your question:
If I choose the latter, an interesting situation can arise in the long run where a single org file has multiple :tangle blocks that output to the same
file. After the tangling, which one is left?
The org info manual says in Section 14.4 Extracting source code:
When Org tangles ‘src’ code ...
There are two options you could use, but I imagine that none are exactly what you want:
1) Create derived classes from the template classes
#+begin_src ruby :tangle ./app/models/appuser.rb
class AppUser < User
Braintree.api_key = "bk-54cfa45"
self.id = Braintree::...
I found the correct variable to set while on an unrelated research dig:
coding can be set in a Local Variables block like so:
# Local Variables:
# mode: org
# coding: utf-8-with-signature
Note: there is a leading space in each line of the preceding source block.
This setting then gets inherited by the tangled files.
I agree that the specification is slightly finicky.
The following should do what you want:
#+TITLE: Console Tic Tac Toe
#+SUBTITLE: A Literate Program in EMACS Org-Mode
#+AUTHOR: Charlie Martin
#+BEGIN_SRC python :tangle yes :noweb tangle