New answers tagged

4

You need to define org-babel-execute:nim: (defun org-babel-execute:nim (body params) "Execute a block of Nim code with org-babel." While we could use nim via STDIN, it will clutter the current working directory. Therefore, let us use a temporary file instead. nim also needs files to start with a letter and end with .nim, so we adjust the ...


2

Method 1 Manual method using default org-mode keybindings Setup Add Org to Org Babel Load Languages configuration and then apply and save new configuration. Add #+EXPORT_FILE_NAME: keyword near top of config.org. e.g. #+EXPORT_FILE_NAME: temp.org Add #+PROPERTY: header-args:org :results drawer replace keyword near top of config.org. e.g. #+PROPERTY: ...


1

Here's a version that seems to work (discovered by trial-and-error; and BTW it is using octave, since I don't have matlab): #+NAME: vectsb #+begin_src octave :var a=[0] :var b=[0] :session a+b #+end_src #+RESULTS: vectsb : 0 #+CALL: vectsb(a=[1 2 3],b=[3 2 1]) #+RESULTS: | 4 | 4 | 4 | The org-babel section of the Org mode manual ...


0

There is another workaround: remove newlines from the referenced code block. According to the Org manual Since this change does not affect noweb replacement text without newlines in them, inline noweb references are acceptable. Here is a minimal example: #+TITLE: Example #+BEGIN_SRC clojure :noweb-ref dep-cljsbuild [lein-figwheel "0.5.9"] [lein-...


2

I don't know how to do this without changing the code (it might be possible with org-babel-pre-tangle-hook but it did not seem at all simple, so I didn't try that). But as soon as you accept code changes, it does not seem too bad. The simplest possible way I could think of was to emulate in org-babel-tangle what org-export-as is doing WRT included files. A ...


2

Found a possible solution by using https://alhassy.github.io/org-special-block-extras/#Folded-Details #+begin_details org :title: Click to see dummy code #+begin_src elisp (message "Dummy code") #+end_src #+end_details


0

You can accomplish this by using the concept of backquoting. Consider the following minimal configuration. Note the usage of `(...) and , within `(...) $ cat ~/.emacs.d/init.el (org-babel-do-load-languages 'org-babel-load-languages '((python . t) (shell . t))) (setq my/path/experiments "~/trash/experimental") (defun path/experiments (&...


2

This is a literate org-mode answer. Copy the whole answer into an Emacs buffer, run M-x org-mode and experiment with the code blocks. You can use a [[info:org#Results of Evaluation][:post]] processing step to limit the number of lines (or list items). The following emacs-lisp snippet takes either a string or a sequence. If DATA is a string, it will split ...


1

touch real.el generates an empty file (if the file does not exist already) and gives it the current time as its modification time, so it is newer than real.org. Since it is newer, it will not be regenerated: org-babel-load tangles only if the org file is newer[1]. So that gives you a few ways to ensure regeneration: delete real.el every time. touch real.org ...


1

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 time you re-run your code. That's an issue if you use cd. You could protect against this by including a block resetting your directory at the start of your file: #...


Top 50 recent answers are included