6

I think you are actually looking for publishing of projects. This does not only work for HTML but also for LaTeX. Projects are managed in org-publish-project-alist. Each entry of that list is one project. There you specify things like project path, publishing path, whether to create latex files that can be translated separately or body only files that can ...


4

TL;DR: Using a persistent library of babel stored in one file can be a simple 3-step setup: Create an org-mode file ~/.emacs.d/library-of-babel.org. Add a line (org-babel-lob-ingest "~/.emacs.d/library-of-babel.org") to your Emacs conf. Collect useful functions in that file, they will be read during emacs startup. The Library-Of-Babel-file is where e.g. ...


4

You can easily define your own link type that runs source blocks: (org-link-set-parameters "run" :follow #'org-babel-ref-resolve) Afterwards a click on run:hello executes the source block in the following Orgmode file. #+name: hello #+begin_src emacs-lisp :var n=1 (message "Hello. n=%s" n) #+end_src #+RESULTS: hello : Hello run:hello [[run:hello(n=2)]...


4

Try this package exec-path-from-shell which should solve your problem.


4

Looks like a bug as wasamasa said, but until that gets fixed this works for me: (setq org-babel-js-function-wrapper "console.log(require('util').inspect(function(){\n%s\n}(), { depth: 100 }))") If you want to print deeper or otherwise modify output, change the options for require('util').inspect(...) in that string, as documented here. If you want ...


4

Use TRAMP multi-hop syntax for :dir header. 4.4 Combining ssh or plink with su or sudo If the su or sudo option shall be performed on another host, it could be comnbined with a leading ssh or plink option. That means, TRAMP connects first to the other host with non-administrative credentials, and changes to administrative credentials on that host ...


3

I use code like this to do that. (defun scimax-ob-clear-all-contents () "Clear all src-block contents in the buffer." (interactive) (save-excursion (goto-char (point-min)) (while (org-babel-next-src-block) (org-edit-special) (delete-region (point-min) (point-max)) (org-edit-src-exit)))) If you just want to remove all the ...


3

The reason for the mismatch is the code contains an angled bracket (">") which is treated as a matching paren. I don't know the solution for how to specify that orgmode emacs-elisp should ignore angled brackets when matching parens (but I would like to know a solution). Note: I posted this as an "answer" because I don't have enough reputation points to ...


3

I've had the same issue with my org settings file. The reason behind was that I used #+BEGIN_SRC elisp instead of #+BEGIN_SRC emacs-lisp. Therefore, the function org-babel-load-file considered that there was no elisp code to execute and return nil. I wasn't aware of that solution early because the code highlight was activated. According to this answer, ...


3

I had a similar use case, and rolled a simple exporter which let me use json-mode for the source/input from stdin: ;;; ob-passthrough.el --- passthrough evaluator -*- lexical-binding: t; -*- ;; this ob evaluates the block as ifself, so it can be used as input ;; for another block (require 'ob) (defun org-babel-execute:passthrough (body params) ...


3

With just a few keystrokes, it is possible to insert empty structural blocks, such as ‘#+BEGIN_SRC’ … ‘#+END_SRC’, or to wrap existing text in such a block. C-c C-, (org-insert-structure-template) Documentation


3

I can reccomend 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 external file is also checked, and if a diff is detected, the user is prompted to either reject or pull the external changes into the org src block. This also has ...


3

You can specify column names as header arguments (see here). #+begin_src sh :colnames '("header1" "header2") echo "value1,value2" echo "value1,value2" #+end_src #+RESULTS: | header1 | header2 | |---------+---------| | value1 | value2 | | value1 | value2 | To answer your second question, here's a solution you can try using sed (see this thread). #+...


3

That is one of the main pillars of babel. Give the C source block a name if you want to use in the variable assignments of another source block. You input the result of the C source block to another source block by the :var header argument. The python source blocks are described at https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html. ...


3

You can use RESULTS for the first session to write out the results, and :var in the second session to import results. #+name: make_temporary_directories #+begin_src bash :session *one* :results output _gpg_tmpdir="$( mktemp -d )" echo $_gpg_tmpdir #+end_src #+RESULTS: make_temporary_directories : /tmp/tmp.iAE5oSlwcC #+name: clean_temporary_directories #+...


3

yes-or-no-p is hard-coded into org-babel-confirm-evaluate. We override it with y-or-n-p locally for org-babel-confirm-evaluate: (eval-when-compile (require 'cl-lib)) (defun org+-substitute-yes-or-no-p (fun &rest args) "Run FUN with ARGS and `yes-or-no-p' locally substituted by `y-or-n-p'." (cl-letf (((symbol-function 'yes-or-no-p) #'y-or-n-p)) ...


3

C-c C-c has the key-binding org-ctrl-c-ctrl-c which runs org-babel-exec-src-block if point is inside a source block. C-x C-e runs eval-last-sexp which has nothing to do with Orgmode. org-babel-execute-src-block uses org-babel-insert-result for inserting the result into the Org buffer. There, org-no-properties removes the text properties from the result ...


3

You can use org-babel-ref-resolve to call named code blocks from one of the hooks before-save-hook or after-save-hook. Example Orgmode-file: #+NAME: myblock #+BEGIN_SRC emacs-lisp (message "Running myblock.") #+END_SRC Local Variables: eval: (add-hook 'before-save-hook (lambda () (org-babel-ref-resolve "myblock")) nil t) End:


3

Editorial comment: Session handling (at least with python) is very much a hack: there are markers inserted to signal where the current output ends, the code has to wait to make sure that all the output has been... ahem ... output, any errors that creep through somehow may be reported as part of the output, etc. That said, you might want to try the following ...


3

The example you pointed to (as you probably already know) require a certain amount of configuration, and also require understanding of certain concept in order to figure out what is going on. I'm going to execute a trivial shell code block in an emacs after ensuring that I am not relying on any of my personal emacs configuration Concepts: Skip emacs ...


2

For reference I found this message on the org-mode mailing list which mentions a way to do this by means of file local #+LATEX_HEADER lines which use the fancyvrb package and redefine the verbatim environment that org-mode #+RESULTS blocks get exported to via: #+LATEX_HEADER: \RequirePackage{fancyvrb} #+LATEX_HEADER: \DefineVerbatimEnvironment{verbatim}{...


2

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 external file is checked also, and if a diff is detected, the user is prompted to either reject or pull the external changes into the org src block. This also has ...


2

Ok, this more or less works when put together in an org file: #+BEGIN_SRC emacs-lisp :results none (require 'cl) (defun org-redisplay-ansi-source-blocks () "Refresh the display of ANSI text source blocks." (interactive) (org-element-map (org-element-parse-buffer) 'src-block (lambda (src) (when (equalp "ansi" (org-element-property :language ...


2

Solution The problem here is caused by the listingsutf8 library (as well as a few other things, described below). The listingsutf8 library is automatically loaded by the most option when importing tcolorbox with usepackage. Removing the most option here will prevent listingsutf8 from being loaded which will allow the source text to show up in the output ...


2

I do not know whether there is an existing function to clear all org source blocks, but here is a quick example of how to do it. CAVEAT: This example does not check for broken source code blocks; e.g., the code assumes there is a matching beginning/ending. (defun org-clear-src-blocks () "Clear src code blocks." (interactive) (save-excursion (goto-...


2

Solved: Opening the above ditaa file in Emacs showed the following bash script: #!/bin/bash exec java -jar /usr/local/Cellar/ditaa/0.11.0/libexec/ditaa-0.11.0-standalone.jar "$@" The above code was evaluated successfully after setting org-ditaa-jar-path to /usr/local/Cellar/ditaa/0.11.0/libexec/ditaa-0.11.0-standalone.jar.


2

Actually the issue is that org-sbe returns a string that represents a list. For instance it returns "(1 2 3)" instead of (1 2 3). Thus we need to convert the string back to a list, which was answered somewhere else, with read-from-string. Thus the emacs-lisp source block becomes: #+BEGIN_SRC emacs-lisp :results output (org-sbe print_table_info ":results ...


2

You need to execute at least the Elisp source block defining the function fig-file once before tangling the file. Otherwise that function is undefined as you see in the error message. You can do so by placing point on the Elisp source block and by pressing C-c C-c. Remark 1: Used Orgmode test file Since I am not familiar with R i tested with a source ...


2

Here is a potential solution: (defun org-mode-<>-syntax-fix (start end) (when (eq major-mode 'org-mode) (save-excursion (goto-char start) (while (re-search-forward "<\\|>" end t) (when (get-text-property (point) 'src-block) ;; This is a < or > in an org-src block (put-text-property (point) (1- (point)) ...


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