Skip to main content
16 votes
Accepted

Does org have any "inverse-tangle" operations e.g. for collaborating with non-org users?

Yes, it's org-babel-detangle. org-babel-detangle is an interactive compiled Lisp function in ob-tangle.el. (org-babel-detangle &optional SOURCE-CODE-FILE) Propagate changes in ...
xuchunyang's user avatar
  • 14.6k
8 votes

Does org have any "inverse-tangle" operations e.g. for collaborating with non-org users?

There is also org-tanglesync, which has a much simpler method of syncing than org-babel-detangle Essentially if a block is tangled to an external file, then every time that block is edited the ...
Mehmet Tekman's user avatar
7 votes
Accepted

Order of blocks in org tangle

The key was to use the :noweb options. One of them, strip-export, let's you add a snippet to the code when tangling but hiding it in the document. Other option is tangle, which is similar but exports ...
RedPointyJackson's user avatar
7 votes

Saving Python matplotlib figures with source-code blocks

I'm a little late but I just figured out a pretty neat way to do this using :file and without using :var. As the other anwser already pointed out plt.show() doesn't produce output. However you can use ...
jasLogic's user avatar
6 votes

literate programming: do folks revise tangle blocks or make copies

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 / ...
Tad Ashlock's user avatar
5 votes
Accepted

The correct way to declare common vars in babel

If you want to add to the value of an existing property, append a ‘+’ to the property name. (info "(org) Property syntax") That means your property drawer should be :PROPERTIES: :header-...
mutbuerger's user avatar
  • 3,504
5 votes
Accepted

EMACS shell mode that supports annotations

Use Literate DevOps Method I recommend using the literate devops method via org-mode, that @phils suggested in the comments, because of the ease of use and adaptable workflow. Example Workflow ...
Melioratus's user avatar
  • 4,688
5 votes
Accepted

switch-buffer for literate programming

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 ...
Tobias's user avatar
  • 33.3k
5 votes

Managing source code annotations and version control

You can bookmark any file, or any part of a code/text file. You can even bookmark a region (and have the region activated when you jump to the bookmark). A bookmark can have an annotation, and that ...
Drew's user avatar
  • 78k
4 votes
Accepted

noweb function call with variable arguments

Try this The reason why the error happens is because you haven't defined y in the x=y arguments. If you update code as follows noweb will work #+NAME: cubed-plus-cubed #+BEGIN_SRC python :noweb ...
Melioratus's user avatar
  • 4,688
4 votes
Accepted

Generate different markup for not-tangled code blocks in org-mode

You can use an :around advice for org-html-src-block to wrap the code block generated by org-html-src-block with your own html block, e.g.: <div style="background-color:lightgray">. But there ...
Tobias's user avatar
  • 33.3k
4 votes
Accepted

How to make org-babel call all remote code blocks under a specific headline?

Ingest Named Code Blocks from other files using org-babel-lob-ingest Add org-babel-lob-ingest command using File Local Variables syntax to ingest named src blocks from an external file for use in ...
Melioratus's user avatar
  • 4,688
4 votes
Accepted

How to stop main wrapping when tangling C in org-babel?

There is a :main header argument defined in ob-C. :main no avoids the wrapping.
mutbuerger's user avatar
  • 3,504
4 votes

One-liner org source tangle

From (org) Structure of code blocks: Live code blocks can also be specified inline using src_<language>{<body>} or src_<language>[<header arguments>]{<body>} So you ...
Tyler's user avatar
  • 22.4k
4 votes
Accepted

How to use org headers as filenames in tangle

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 ...
Melioratus's user avatar
  • 4,688
4 votes

Saving Python matplotlib figures with source-code blocks

The basic problem is that plt.show() does not produce anything (other than showing the image as a side-effect and blocking), so there is nothing to save (it actually produces the None object, so that'...
NickD's user avatar
  • 30.9k
3 votes
Accepted

Use noweb reference in eLisp code in source block in org-mode

I found the solution to your problem. Your file should look like this #+name: conceptmap #+begin_src org :exports none (ONE) {TWO} (THREE) (FOUR) {FIVE} (SIX) #+end_src #+begin_src emacs-lisp :...
Joafigue's user avatar
  • 773
3 votes

How do I define default language for org-mode source code blocks?

In order not to type the language each time you create a code block, I propose you use some keybindings. Here is an example based on my config: #+begin_src emacs-lisp (add-to-list 'org-structure-...
crocefisso's user avatar
  • 1,363
3 votes
Accepted

Add parent heading of source code block as comment in tangled file

To include the preceding text of a source block in a tangled file, you can use the header argument with the following option :comments org. Per heading * Function heading :PROPERTIES: :header-args: :...
grszkthfr's user avatar
2 votes
Accepted

org-babel-load-file doesn't load entire file

You have #+end_src emacs-lisp. This confuses org-babel. Use just #+end_src. Use the easy template system to insert structural elements and avoid such issues. Source blocks are <s <TAB>.
Tianxiang Xiong's user avatar
2 votes

It is possible to instrument a literate Org-mode configuration file with a backing Emacs Lisp file?

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 ...
John Kitchin's user avatar
  • 11.9k
2 votes
Accepted

How to call org-lint against org-mode file from command-line

Calling org-lint against org-mode file from command-line Create an org-mode file For example, create a new file named org-lint-ex1.org * Using =org-lint= to Check org-mode Syntax ** Inside emacs 1....
Melioratus's user avatar
  • 4,688
2 votes

literate programming: do folks revise tangle blocks or make copies

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 ...
Melioratus's user avatar
  • 4,688
2 votes

ob-tangle or not?

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-...
147pm's user avatar
  • 2,979
2 votes
Accepted

Managing code libraries with org-babel

See https://orgmode.org/manual/Library-of-Babel.html#index-babel_002c-library-of where the call to org-babel-lob-ingest is documented, which is bound to C-c C-v i and then https://orgmode.org/manual/...
p_wiersig's user avatar
  • 1,081
2 votes
Accepted

How to concatenate similar groups of blocks during tangle with noweb syntax?

Apparently this can be fixed by using :noweb-ref instead: * FOO #+BEGIN_SRC emacs-lisp :noweb-ref require (require 'foo) #+END_SRC #+BEGIN_SRC emacs-lisp :noweb-ref execute (foo-setup) #+END_SRC * ...
coredump's user avatar
  • 166
2 votes
Accepted

Managing path for reproductible scientific paper using session, org-babel and org-mode

Your use case is a bit unusual, but I think you can get what you want with a few tweaks. As you've discovered, when you use the session argument, you will re-use the same active bash/R session each ...
Tyler's user avatar
  • 22.4k
2 votes

How do I define default language for org-mode source code blocks?

It is not possible now. The documentation says the language argument is mandatory. https://emacsdocs.org/docs/org/Structure-of-Code-Blocks#language At the top of the file, I can have the property #+...
ruby_object's user avatar
2 votes
Accepted

Evaluate Single Python Code Blocks in a Quarto File like in R Studio or Jupyter Lab

EDIT Probably a cleaner way than the original answer is to just define a suitable polymode-eval-region-function. Inspecting again poly-R.el, we find that we can define an appropriate function as ...
dalanicolai's user avatar
  • 7,865

Only top scored, non community-wiki answers of a minimum length are eligible