Giter VIP home page Giter VIP logo

ob-async's Introduction

Build Status MELPA Stable MELPA

ob-async enables asynchronous execution of org-babel src blocks, like this:

Demo of async sh execution

ob-async isn't tied to src blocks in a specific org-babel language. Simply add the keyword :async to the header-args of any org-babel src block and invoke ob-async-org-babel-execute-src-block.

Installation

ob-async is available in MELPA. If you'd rather install from source, make sure ob-async.el is on your load-path, like this.

(add-to-list 'load-path "$PATH_TO_OB_ASYNC_ROOT_DIR")

Require the package and ob-async will handle any source block which includes :async in its header-args.

(require 'ob-async)

Configuration

ob-async should work with no additional setup for most languages. However, there are a few known edge-cases which require extra configuration.

ob-async-no-async-languages-alist

Some org-babel languages (e.g., ob-python) define their own :async keyword that conflicts with ob-async. ob-async will ignore any languages in this blacklist, even if the :async keywords is present. Note that the -alist suffix is misleading; this variable actually represents a plain list and will be renamed in a future release.

Example:

(setq ob-async-no-async-languages-alist '("ipython"))

For additional context, see #35.

ob-async-pre-execute-src-block-hook

Some org-babel languages require additional user configuration. For example, ob-julia requires inferior-julia-program-name to be defined. Normally you would define such variables in your init.el, but src block execution occurs in an Emacs subprocess which does not evaluate init.el on startup. Instead, you can place initialization logic in ob-async-pre-execute-src-block-hook, which runs before execution of every src block.

Example:

(add-hook 'ob-async-pre-execute-src-block-hook
        '(lambda ()
           (setq inferior-julia-program-name "/usr/local/bin/julia")))

For additional context, see #37 and jwiegley/emacs-async#73.

Development

Cask manages dependencies and runs tests. Once Cask is installed, you can make test.

Troubleshooting

First, go through the troubleshooting checklist, troubleshooting.org. It's an org-mode file in this repository that's designed to diagnose issues with ob-async. If that doesn't solve your problem, include a copy of the entire file (which will include your #+RESULTS blocks) in a Github issue.

ob-async's People

Contributors

astahlman avatar casch-at avatar dakra avatar f4nyc avatar gjstein avatar stardiviner avatar stnutt avatar stsquad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ob-async's Issues

emacs 29.1 breaks async blocks

Checklist

  • [ X] I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

The result of the troubleshooting.org guide is that all non async blocks work. All async blocks fail with message:
(note: I had to change incf for cl-incf).

Expected Behavior

working async blocks

Actual Behavior

All async blocks fail with message:

error in process sentinel: async-handle-result: Recursive load: "/home/alberto/.emacs.d/straight/build/org/org.elc", "/home/alberto/.emacs.d/straight/build/org/org-element.elc", "/home/alberto/.emacs.d/straight/build/org/ox.elc", "/home/alberto/.emacs.d/straight/build/org/ox-ascii.elc", "/home/alberto/.emacs.d/straight/build/org/ob-gnuplot.elc", "/home/alberto/.emacs.d/straight/build/org/org.elc", "/home/alberto/.emacs.d/straight/build/org/org-element.elc", "/home/alberto/.emacs.d/straight/build/org/ox.elc", "/home/alberto/.emacs.d/straight/build/org/ox-ascii.elc", "/home/alberto/.emacs.d/straight/build/org/ob-gnuplot.elc", "/home/alberto/.emacs.d/straight/build/org/org.elc", "/home/alberto/.emacs.d/straight/build/org/org-element.elc", "/home/alberto/.emacs.d/straight/build/org/ox.elc", "/home/alberto/.emacs.d/straight/build/org/ox-ascii.elc", "/home/alberto/.emacs.d/straight/build/org/ob-gnuplot.elc", "/home/alberto/.emacs.d/straight/build/org/org.elc", "/home/alberto/.emacs.d/straight/build/org/org-element.elc", "/home/alberto/.emacs.d/straight/build/org/ox.elc", "/home/alberto/.emacs.d/straight/build/org/ox-ascii.elc", "/home/alberto/.emacs.d/straight/build/org/ob-gnuplot.elc", "/home/alberto/.emacs.d/straight/build/org/org.elc"

Steps to Reproduce

Troubleshooting Artifacts

(Copy-paste the contents of your troubleshooting.org buffer into a gist and add the link here)

ob-async does not specify correct minimum required Emacs version - seq-random-elt missing

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • (hopefully) Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

  • The code should run, give a sensible result, and run asynchronously.
  • Versions should be specified correctly for the ob-async package.

Actual Behavior

  • The code is not run without error and the result is weird.
  • Versions are specified as follows in the melpa-stable package summary inside Emacs: Requires: async-1.9, org-9.0.1, emacs-24.4, dash-2.14.1, however, emacs-24.4 does not seem to have seq-random-elt.

Steps to Reproduce

  1. Install Emacs in version: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian
  2. Install ob-async via list-packages and from melpa-stable
  3. Create an Org-mode file.
  4. Add the following source block:
#+BEGIN_SRC elisp :async :results output
(async-start
   ;; What to do in the child process
   (lambda ()
     (message "This is a test")
     (sleep-for 3)
     222)

   ;; What to do when it finishes
   (lambda (result)
     (message "Async process done, result should be 222: %s" result)))
#+END_SRC
  1. Try to run the code.
  2. See the error message in the *messages* buffer.

Troubleshooting Artifacts

I created an emacs.stackexchange question about this problem: https://emacs.stackexchange.com/questions/48658/ob-async-issue-seq-random-elt-not-defined

Here is my troubleshooting.org file: https://gist.githubusercontent.com/ZelphirKaltstahl/68ab4f8cbd558fb6eea71e211adb1269/raw/cdd614e8069f7bd3a6da64c1d594e07414b49f6f/troubleshooting.org

Different end-of-line characters shown when using :async

Hi,

I use ob-asycn, great package: thanks!
I'm using Emacs 27.0.50 (git) on Windows x64. When using :async, the output shows ^M (carriage return / line feed) after each output line.
Without :async, the output is correct (no carriage returns, just line feeds)

Example with :async:

   #+BEGIN_SRC sh
   echo $SHELL
   #+END_SRC

   #+RESULTS:
   :RESULTS:
   /usr/bin/zsh

   :END:

Note that the ^M character is replaced here by two blank lines: Emacs shows ^M in the Org mode file.

Example without :async:

   #+BEGIN_SRC sh
   echo $SHELL
   #+END_SRC

   #+RESULTS:
   :RESULTS:
   /usr/bin/zsh
   :END:

Cheers,

Peter

ob-async does not work with tramp methods in :dir header argument

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

#+RESULTS:
: /

Actual Behavior

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

#+RESULTS:
: c3b1c8c713d89c0548ffb9d9e7bf50cf

It never returns. The process never ends.

Steps to Reproduce

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

Troubleshooting Artifacts

Does not work with ob-sql-mode?

Checklist

  • [ x] I followed the troubleshooting guide and it did not address my issue
  • [ x] I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

sql-mode org-babel block executes with :async

Actual Behavior

Fails with ERROR: error in process sentinel: Symbol’s function definition is void: org-babel-execute:sql-mode

Steps to Reproduce

  • I'm using https://github.com/nikclayton/ob-sql-mode/

  • Use sql-postgres or sql-connect to start a psql inferior buffer (probably works with other connections too)

  • Name the buffer *SQL: postgres:test* to match <product>:<session> in the header

  • Execute with C-c C-c. The Result block gets generated, but isn't resolved, and I get an error.

Troubleshooting Artifacts

https://gist.github.com/indigoviolet/dc433a83fa851f3413f291bf850f50ab

View output of process before it finishes

Is it possible to view the output of the process that is being executed by ob-sync while it is still running? I would like to see at which point of the execution my program is, since it prints progress on the standard output, but I've found no mention of this in the readme. As a possible approach, redirecting the output of the program to a temporary buffer would be fine!

Thanks for the great work!

Can't find ob-shell?

I'm sure it's probably a problem with my config --

Installed ob-async via Melpa. I've turned on debugging, but every time I try to run a SQL code block with the :async header I get the following problems:

executing Sql code block... Transmitting sexp {{{'(lambda nil (setq exec-path '("/usr/local/opt/pyenv/shims" "/usr/local/pgsql/9.6/bin" "/Applications/Racket v6.2.1/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/local/bin" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/opt/X11/bin" "/usr/texbin" "/Users/parataxis/.pyenv/shims" "/Applications/Racket v6.2.1/bin" "/usr/local/sbin" "/opt/local/bin" "/Users/parataxis/.local/bin" "/usr/local/texlive/2013/bin/x86_64-darwin" "/opt/local/bin" "/Users/parataxis/.local/bin" "." "/usr/local/texlive/2013/bin/x86_64-darwin" "/usr/local/opt/go/libexec/bin" "/usr/local/Cellar/emacs/HEAD/libexec/emacs/25.1.50/x86_64-apple-darwin15.5.0" "/usr/local/bin")) (package-initialize) (org-babel-do-load-languages 'org-babel-load-languages '((python . t) (perl . t) (R . t) (sql . t) (shell . t) (lilypond . t) (restclient . t) (gnuplot . t) (R . t) (ditaa . t))) (org-babel-execute:sql "SELECT *\nFROM foo" '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:dir . "/wk_linode:/home/nyamada") (:dbhost . "seo-reports.ziprecruiter.com") (:engine . "postgresql") (:dbuser . "seo_admin") (:database . "seo_reports") (:cmdline . "-X") (:async)))) }}} error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, ob-shell error in process sentinel: Cannot open load file: No such file or directory, ob-shell Quit Auto-saving...done Mark set

I've got ob-shell enabled and it works in the parent process.

Errors in code evaluation are not reported on screen

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Evaluating the following block code does not report an error on screen (using another "org error" buffer)

#+begin_src python :async
  raise NotImplementedError
#+end_src

If you evaluate it withou :async, then the error is reported on screen.

The last section in troubleshooting.org shows this issue

Named source block with ob-async caused error

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Here is my source block with named.

#+NAME: clone source code
#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file "code-maat/README.md" :async
if [ -d code-maat ]; then
  cd code-maat ; git pull
else
  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat
fi
#+end_src

Actual Behavior

When I toggle debug-on-error, I got stacktrace:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011"))
  (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete.")))
  (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))
  (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil)))
  (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))))
  (let ((inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context)))) (if inline (progn (let ((warning (or (and (member "table" result-params) "`:results table'") (and (listp result) "list result") (and (string-match-p "\n." result) "multiline result") (and (member "list" result-params) "`:results list'")))) (if warning (progn (user-error "Inline error: %s cannot be used" warning)))))) (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil)))))
  (if (and result-params (member "silent" result-params)) (progn (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (let ((inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context)))) (if inline (progn (let ((warning (or (and (member "table" result-params) "`:results table'") (and (listp result) "list result") (and (string-match-p "\n." result) "multiline result") (and (member "list" result-params) "`:results list'")))) (if warning (progn (user-error "Inline error: %s cannot be used" warning)))))) (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))))))
  org-babel-insert-result("code-maat/README.md" ("output" "replace" "file" "link") ("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") nil "sh")
  (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))
  (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))
  (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))))
  (save-current-buffer (set-buffer #<buffer Code Maat.org>) (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))
  (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))
  (lambda (result) (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))))))("Already up to date.\n")
  async-handle-result((lambda (result) (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))) "Already up to date.\n" #<buffer *emacs*>)
  async-when-done(#<process emacs> "finished\n")

And

Debugger entered--Lisp error: (wrong-type-argument markerp nil)
  set-marker(nil nil)
  (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))
  (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil)))
  (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))))
  (let ((inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context)))) (if inline (progn (let ((warning (or (and (member "table" result-params) "`:results table'") (and (listp result) "list result") (and (string-match-p "\n." result) "multiline result") (and (member "list" result-params) "`:results list'")))) (if warning (progn (user-error "Inline error: %s cannot be used" warning)))))) (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil)))))
  (if (and result-params (member "silent" result-params)) (progn (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (let ((inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context)))) (if inline (progn (let ((warning (or (and (member "table" result-params) "`:results table'") (and (listp result) "list result") (and (string-match-p "\n." result) "multiline result") (and (member "list" result-params) "`:results list'")))) (if warning (progn (user-error "Inline error: %s cannot be used" warning)))))) (save-excursion (let* ((visible-beg (point-min-marker)) (visible-end (copy-marker (point-max) t)) (inline (let ((context (org-element-context))) (and (memq (org-element-type context) '(inline-babel-call inline-src-block)) context))) (existing-result (org-babel-where-is-src-block-result t nil hash)) (results-switches (cdr (assq :results_switches (nth 2 info)))) (outside-scope (and existing-result (buffer-narrowed-p) (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end indent) (if (and (org-string-nw-p result) (not inline) (not (string-equal (substring result -1) "\n"))) (progn (setq result (concat result "\n")))) (unwind-protect (progn (if outside-scope (progn (widen))) (if existing-result (goto-char existing-result) (goto-char (org-element-property :end inline)) (skip-chars-backward " \011")) (if inline nil (setq indent (current-indentation)) (forward-line 1)) (setq beg (point)) (cond (inline (if existing-result nil (insert " ") (setq beg (point)))) ((member "replace" result-params) (delete-region (point) (org-babel-result-end))) ((member "append" result-params) (goto-char (org-babel-result-end)) (setq beg (point-marker))) ((member "prepend" result-params))) (setq results-switches (if results-switches (concat " " results-switches) "")) (let ((wrap (function (lambda (start finish &optional no-escape no-newlines inline-start inline-finish) (if inline (progn (setq start inline-start) (setq finish inline-finish) (setq no-newlines t))) (let ((before-finish (marker-position end))) (goto-char end) (insert (concat finish (if no-newlines nil "\n"))) (goto-char beg) (insert (concat start (if no-newlines nil "\n"))) (if no-escape nil (org-escape-code-in-region (min (point) before-finish) before-finish)) (goto-char end))))) (tabulablep (function (lambda (r) (and (proper-list-p r) (cl-every (function (lambda (e) (or (atom e) (proper-list-p e)))) result)))))) (cond ((null result)) ((member "list" result-params) (insert (org-trim (org-list-to-generic (cons 'unordered (mapcar (function (lambda (e) (list (if (stringp e) e (format "%S" e))))) (if (listp result) result (split-string result "\n" t)))) '(:splicep nil :istart "- " :iend "\n"))) "\n")) ((funcall tabulablep result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl (if (cl-every (function (lambda (e) (or (eq e 'hline) (listp e)))) result) result (list result)) nil) "\n")) (goto-char beg) (if (org-at-table-p) (progn (org-table-align))) (goto-char (org-table-end))) ((listp result) (insert (format "%s\n" result))) ((member "file" result-params) (if inline (progn (setq result (org-macro-escape-arguments result)))) (insert result)) ((and inline (not (member "raw" result-params))) (insert (org-macro-escape-arguments (org-babel-chomp result "\n")))) (t (goto-char beg) (insert result))) (setq end (copy-marker (point) t)) (cond ((assq :wrap (nth 2 info)) (let ((name (or (cdr (assq :wrap (nth 2 info))) "results"))) (funcall wrap (concat "#+begin_" name) (concat "#+end_" (car (split-string name))) nil nil (concat "{{{results(@@" name ":") "@@)}}}"))) ((member "html" result-params) (funcall wrap "#+begin_export html" "#+end_export" nil nil "{{{results(@@html:" "@@)}}}")) ((member "latex" result-params) (funcall wrap "#+begin_export latex" "#+end_export" nil nil "{{{results(@@latex:" "@@)}}}")) ((member "org" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap "#+begin_src org" "#+end_src" nil nil "{{{results(src_org{" "})}}}")) ((member "code" result-params) (let ((lang (or lang "none"))) (funcall wrap (format "#+begin_src %s%s" lang results-switches) "#+end_src" nil nil (format "{{{results(src_%s[%s]{" lang results-switches) "})}}}"))) ((member "raw" result-params) (goto-char beg) (if (org-at-table-p) (progn (org-cycle)))) ((or (member "drawer" result-params) (member "wrap" result-params)) (goto-char beg) (if (org-at-table-p) (progn (org-cycle))) (funcall wrap ":results:" ":end:" 'no-escape nil "{{{results(" ")}}}")) ((and inline (member "file" result-params)) (funcall wrap nil nil nil nil "{{{results(" ")}}}")) ((and (not (funcall tabulablep result)) (not (member "file" result-params))) (let ((org-babel-inline-result-wrap (format "{{{results(%s)}}}" org-babel-inline-result-wrap))) (org-babel-examplify-region beg end results-switches inline))))) (if (and (not inline) (numberp indent) (> indent 0) (not (and (listp result) (member "append" result-params)))) (progn (indent-rigidly beg end indent))) (if (null result) (if (member "value" result-params) (message "Code block returned no value.") (message "Code block produced no output.")) (message "Code block evaluation complete."))) (set-marker end nil) (if outside-scope (progn (narrow-to-region visible-beg visible-end))) (set-marker visible-beg nil) (set-marker visible-end nil))))))
  org-babel-insert-result("code-maat/README.md" ("output" "replace" "file" "link") ("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") nil "sh")
  (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))
  (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))
  (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))))
  (save-current-buffer (set-buffer #<buffer Code Maat.org>) (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))
  (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))
  (lambda (result) (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook))))))("Already up to date.\n")
  async-handle-result((lambda (result) (with-current-buffer #<buffer Code Maat.org> (let ((default-directory "/home/stardiviner/Org/Wiki/Computer Technology/Softwares/data/code/")) (save-excursion (goto-char (point-min)) (re-search-forward "72afb2aa9264f9caf40d2beeb8818943") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("output" "replace" "file" "link"))))))) (org-babel-insert-result result '("output" "replace" "file" "link") '("sh" "if [ -d code-maat ]; then\n  cd code-maat ; git pull\nelse\n  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat\nfi" ((:colname-names) (:rowname-names) (:result-params "output" "replace" "file" "link") (:result-type . output) (:results . "output replace file link") (:exports . "") (:session . "none") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:cache . "yes") (:eval . "never-export") (:mkdirp . "yes") (:dir . "data/code") (:file . "code-maat/README.md") (:async)) "" "clone source code" 2073 "# (ref:%s)") 'nil '"sh") (run-hooks 'org-babel-after-execute-hook)))))) "Already up to date.\n" #<buffer *emacs*>)
  async-when-done(#<process emacs> "finished\n")

Steps to Reproduce

#+NAME: clone source code
#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file "code-maat/README.md" :async
if [ -d code-maat ]; then
  cd code-maat ; git pull
else
  git clone --recursive https://github.com/adamtornhill/code-maat.git code-maat
fi
#+end_src

Troubleshooting Artifacts

(Copy-paste the contents of your troubleshooting.org buffer into a gist and add the link here)

Consider integrating into mainline org repo?

I took a quick look at the source code for this and it seems that it's basically a copy/paste of org-babel-execute-src-block, with modifications for asynchronous execution. I think this would make it tough to stay in sync with org because any significant/relevant changes to org-babel-execute-src-block can break this package. I think it would make sense to merge this into the mainline so that any changes to org-babel-execute-src-block don't also need to be made here. Have you considered doing this?

Feature: Ability to cancel to async requests

Maybe there's already a way to do this, but I'm not sure how:

I'd like to be able to cancel the async request for a given block.

I'm unsure how feasible this is, but thought I'd start the discussion.

Thanks for an excellent package!

error in process sentinel: async-when-done: Invalid read syntax: "#"

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

NOTE

  • I had to redact some information from troubleshooting.org as it included a lot of sensitive information!
  • Not sure how reproducible it is for other, but for me, it happens 100% of the time

Expected Behavior

Running async block, replacing result with the results.

Actual Behavior

error in process sentinel: async-when-done: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"

Steps to Reproduce

I get the same error for all blocks with :async

Troubleshooting Artifacts

https://gist.github.com/simendsjo/c39671e029a63c40dce342b446ddf023

ob-async seems ignored :dir header argument

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

The source block should take advantage of :dir header argument.

Actual Behavior

It seems missed it.

And it report error:

executing Sh code block...
Saving file /home/stardiviner/Org/Wiki/Computer Technology/Operating System/Linux/Command Line/Command Line.org...
Wrote /home/stardiviner/Org/Wiki/Computer Technology/Operating System/Linux/Command Line/Command Line.org
source-code block ‘12:16:53>’ not found in this buffer
error in process sentinel: save-current-buffer: Opening output file: No such file or directory, /home/stardiviner/Org/Wiki/Computer Technology/Operating System/Linux/Command Line/the-art-of-command-line/README.md
error in process sentinel: Opening output file: No such file or directory, /home/stardiviner/Org/Wiki/Computer Technology/Operating System/Linux/Command Line/the-art-of-command-line/README.md
Mark set

Steps to Reproduce

#+begin_src sh :mkdirp yes :results file link :dir "Data/Books" :file "the-art-of-command-line/README.md" :async
if [ -d the-art-of-command-line ]; then
  cd the-art-of-command-line ; git pull
else
  git clone --recursive https://github.com/jlevy/the-art-of-command-line.git the-art-of-command-line
fi
#+end_src

Without the ~:async~, it works fine.

Troubleshooting Artifacts

https://gist.github.com/stardiviner/28d9dd594a4de2fa726277c279760387

Feature: Ability to interact with running process

Today I found myself running a script with this wonderful package.

Inside the script, there 's a line

byebug; # debugger

and when execution hits that line, it's REPL should appear in my emacs.
When I hit c (for continue in byebug), the execution should resume.

Am I asking too much of this package?

Async not working with CALL

#+NAME: sleep
#+BEGIN_SRC shell :async
sleep 2 && pwd
#+END_SRC

#+RESULTS: sleep
: eae1247455e5d35b9eb36671b10a317a

#+CALL: sleep()

#+RESULTS:
: /root

Problem interacting with ob-julia

Checklist

  • [-] I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Actual Behavior

uuid created in the results, message:

executing Bash code block...
error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name

Steps to Reproduce

Install ob-async + ob-julia
(I'm trubleshooting it and I'll provide better info here)

edit: the problem is ob-julia not ess

Request: tag a stable release

Now the extension has been around awhile I think it's time to tag a stable release. This will help those who want to use melpa-stable for some of their machines. Thanks.

Execute asynchronous processes on remote host

Is it possible to execute the code block on a remote host? I tried to use the :dir header argument with a tramp file link but this didn't work. I guess async-start would have to spawn the emacs instance on the remote and not the local host but I am not sure if it can be done.

Async blocks fail when called from a table formula with org-sbe

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

When calling an async block from a table formula with org-sbe, it should execute asynchronously and eventually populate the table cell(s) with the results.

Actual Behavior

It immediately populates the cell(s) with #ERROR

Steps to Reproduce

  1. Create a named async source block, let's call it gimme_that
  2. Create a table
  3. Add a formula to the table which calls the source block using org-sbe, such as $1='(org-sbe "gimme_that")
  4. Refresh the table formulas

Also, see the requested gist below.

Troubleshooting Artifacts

https://gist.github.com/mkrauss/3a908cb8bdf7ac9e0fcd5a660d161d0e

C-c C-c on name property executes block synchronously

Hello!
Thanks hugely for this extension of org mode! I can finally run the slow stuff while taking notes in org: that's wonderful!

There is a really minor issue, that can surprise someone else: here I report it.
Say you have the following block and ob-async installed:

#+NAME: sleep 5 seconds
#+BEGIN_SRC sh :async
sleep 5s
#+END_SRC

when your point is on the NAME property and you try to run the block with C-c C-c,
the synchronous version of the block is run.
I am not sure if you intended this as a feature,
but for me is hard to remember to not run the block on the name bit.

Thanks a lot again for your effort and for sharing this mode with us!

A MELPA package?

Most Emacsers these days use package-install. It would be nice if ob-async had a package on MELPA...

Calls to second emacs process seems to fail

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Async returns successfully and placeholder text is replaced with output.

Actual Behavior

Async calles emacs which either doesn't load or fails, placeholder text never get's updated.

Steps to Reproduce

I think this may be related to async--transmit-sexp, the version of org, emacs, or some other package collision:

I either get this during the above:

#+BEGIN_EXAMPLE
async--transmit-sexp: Process emacs not running
#+END_EXAMPLE

Or the following during shell blocks:

#+BEGIN_EXAMPLE
executing Shell code block...
"emacs" #<buffer *emacs*<2>> "/usr/local/bin/emacs-26.2" "-Q -l /usr/local/share/emacs/site-lisp/quelpa/melpa/recipes/async -batch -f async-batch-invoke <none>"
async--transmit-sexp: process emacs no longer connected to pipe; closed it
#+END_EXAMPLE

Troubleshooting Artifacts

https://gist.githubusercontent.com/hh/67c72f2d83284146a1d3c88e42bc02fd/raw/a3de70b0a36cb740eff2c5ff0fe31b11ae0bddeb/troubleshooting.org

org-babel-python-command is ignored

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

If (setq org-babel-python-command "python3"), then ob-async executions should use python3.

Actual Behavior

ob-async executions still use python2.

Steps to Reproduce

  1. (setq org-babel-python-command "python3")
  2. Check version of python used by ob-async using import sys; print(sys.version_info) and :results output. For example,
#+begin_src python :async :results output
import sys
print(sys.version_info)
#+end_src

#+RESULTS:
: sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0)

#+begin_src python :results output
import sys
print(sys.version_info)
#+end_src

#+RESULTS:
: sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)

Troubleshooting Artifacts

https://gist.githubusercontent.com/ning-y/63687521272d2489d5e3317de44017c7/raw/2adb271f8ff541f86ba3ba2abbf5d2f8a28ceb56/troubleshooting.org

RESULTS replaced before the confirmation

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Consider following simple template:

#+BEGIN_SRC sh :dir ~ :results output replace :async 
echo Hello, World!
#+END_SRC

When I press C-c I get:

Evaluate this sh code block on your system? (y or n) y
and the RESULTS block is changed to:

#+RESULTS:
: 6fc00bde7e0c6b7623f6e3e05c16fbba

after I confirm the execution

Actual Behavior

When I press C-c I get RESULTS block changed immediately, the answer y/n does not matter

#+RESULTS:
: 6fc00bde7e0c6b7623f6e3e05c16fbba

error in process sentinel: async-when-done: Recursive ‘require’ for feature ‘cl-lib’

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

C-c C-c should work like before but asyncly

Actual Behavior

I get an error:

error in process sentinel: async-when-done: Recursive ‘require’ for feature ‘cl-lib’
error in process sentinel: Recursive ‘require’ for feature ‘cl-lib’

and the results is just the UUID

Steps to Reproduce

emacs -Q troubleshooting.org

M-x package-initialize RET

M-: (require 'ob-async)

then eval the :async block from troubleshooting.org

ob-async-1.0.0 from Melpa, also tried 9aac486

emacs 29 11c1aa1eb12cb8601355512387c80bf71a2deeb5

Troubleshooting Artifacts

https://gist.githubusercontent.com/unhammer/7133f668748b85d46f7b62a566e8c7da/raw/1ce0329177f19acdb73cef8a6046ed4e4142a1f3/ob-async-troubleshooting.org

The :async keyword doesn't seem to work

According to the documentation I should be able to async-ify the execution of org-babel blocks by adding the :async keyword. This doesn't seem to work when I C-c C-c blocks, only if I manually call M-x ob-async-org-babel-execute-src-block.

Looking at the code I can see there is an alias but I'm not sure what the magic for overriding based on keywords is meant to do.

Error: (wrong-type-argument stringp nil)

Checklist

  • [ x ] I followed the troubleshooting guide and it did not address my issue
  • [ x ] I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • [ x ] Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Output correct results

Actual Behavior

Error, no output

Steps to Reproduce

C-c C-c on this block

#+BEGIN_SRC emacs-lisp :async
(sleep-for 3)
(file-relative-name (file-name-directory buffer-file-name)
(file-truename (doom-modeline-project-root)))
(message "Hello, Elisp!")
#+END_SRC

Troubleshooting Artifacts

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  signal(wrong-type-argument (stringp nil))
  async-handle-result((lambda (result) (with-current-buffer #<buffer src.org> (save-excursion (goto-char (point-min)) (re-search-forward "1b5dff1ff6ebaafc6b901842b358d292") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("replace"))))))) (org-babel-insert-result result '("replace") '("emacs-lisp" "(sleep-for 3)\n(message \"Hello, Elisp!\")\n\n(file-relative-name (file-name-directory buffer-file-name)\n                      (file-truename (doom-modeline-project-root)))" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)) "" nil 859 "(ref:%s)") 'nil '"emacs-lisp") (run-hooks 'org-babel-after-execute-hook))))) (async-signal (wrong-type-argument stringp nil)) #<buffer *emacs*>)
  async-when-done(#<process emacs> "finished\n")

ob-async doesn't support :var

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

I can use #+NAME: and :var to pass the result of one block to another block even if the first block is :async

Actual Behavior

Even after the block finishes executing and the result is shown, #<process emacs> is stored under the name of the block. For example:


#+NAME: result-value
#+BEGIN_SRC shell :async
echo FooBar
#+END_SRC

#+RESULTS: result-value
: FooBar

#+BEGIN_SRC shell :var input_var=result-value
echo $input_var
#+END_SRC

#+RESULTS:
:results:
#<process emacs>
:end:

Steps to Reproduce

  1. Use #+NAME: result-value to store the result of an :async shell block's execution.
  2. Run the block and wait for execution to finish and the result to be displayed
  3. Pass that result to another shell block with :var input_var=result-value and write code to print the value of that variable in the block.
  4. Run the block and observe that the value passed is not the value of the first block's execution and instead #<process emacs> or possible #<process emacs <n>>

Troubleshooting Artifacts

troubleshooting.org and a direct link to the raw troubleshooting.org file that shows the results of the blocks.

Note

In the case of python (and possibly other languages) this breaks the code necessary to store the value. As a result, attempting to execute a block with a variable set by an async block will lead to a SyntaxError. I'm including this note because the first keywords I googled for related to this error, before I realized it was a broader issue.

  File "<stdin>", line 3
    input_var=#<process emacs>
                             ^
SyntaxError: invalid syntax

Org babel exports results

Org-export-dispatch is not exporting the result of ob-async but this intermediate random number.

For example:

#+begin_src sh :results output replace :exports results :async
sleep 2s && echo "Hello World"
#+end_src

exports (as text output):

┌────
│ f26e93dae63d719bede4c9dd9b951858
└────

It should export 😉 :

┌────
│ Hello World
└────

bash src blocks with :results raw not working any more

I have bash examples, which work nicely from terminal, giving some text output, those were working in the past also nicely in org-mode as src blocks via org-babel.

But after a ubuntu update, with emacs and org-mode updates, both latest, now those bash commands do not work any more from inside org-mode, however from terminal they are working nicely.

Can ob-async help here? Or can the problem be any async issues? Normal org-bash src blocks are working, so if the bash command is something like "pwd", this works. But not my other shell script, which takes some more time, needs to collect data, process, finally showing me the text result after a jq conversion, and this .sh command is not working any more. Any useful tips and hints? Thanks in advance.

org-babel-execute-src-block added one more argument

ob-async-org-babel-execute-src-block has the following signature.

(defun ob-async-org-babel-execute-src-block (&optional orig-fun arg info params)
 ...)

However, new version of org changed its signature as follows:

(defun org-babel-execute-src-block (&optional arg info params executor-type)
 ...)

We should add extra argument to not trigger errors.

ob-synchro-org-babel-execute-src-block

Hi, thank you for a brilliant package. I have a feature request for a function ob-synchro-org-babel-execute-src-block that will ignore the :async t statements.

Reasoning is this. When dealing with individual source code blocks async is very useful but when using functions like org-babel-execute-to-point all code blocks should be executed one after another (synchronously). The new function (ob-synchro-org-babel-execute-src-block) can be incorporated in the definition of the org-babel-execute-to-point.

My usage case is iPython with some blocks that take few minutes to execute, while waiting I can still work on the org-file and prepare next code blocks for testing, and this is thanks to ob-async. When done with testing I want to execute all blocks one after another (synchronously). This can take hours, but I can start new Emacs process ;)

async can't work

when i use C-c C-c have a error in spacemacs

error in process sentinel: async-handle-result: Symbol’s function definition is void: org-babel-execute:sh
error in process sentinel: Symbol’s function definition is void: org-babel-execute:sh

my code

#+begin_src sh :async
sleep 3s && echo 'done'
#+end_src

#+RESULTS:
: bab27cb22081f0f5e2b6f9d4c58dce2d

Conflicting with ob-ipython but no ipython src block is in affect.

Hi,

Running
GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-02-15

When trying out this package I got the following issue
error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, ob-ipython

for the following orgmode buffer, trying to evaluate the sh block with :async

#+begin_src emacs-lisp
(add-to-list 'org-ctrl-c-ctrl-c-hook 'ob-async-org-babel-execute-src-block)
#+end_src

#+RESULTS:
| ob-async-org-babel-execute-src-block |

#+begin_src sh :async
sleep 3s && echo 'Done!'
#+end_src

#+RESULTS:
: 7844d44267638078301c3e39bca2bf9d

I'm using https://github.com/gregsexton/ob-ipython but I'm not evaluating a ipython block.
As can bee seen the id is generate and put in place but the results never get run.
The code block works without the :async argument as expected.

Hopefully this is something minor and if I could get some input on how to find the issue or give some more info to fix this, let me know.

ob-async should support :session header-arg

Desired behavior

#+BEGIN_SRC sh :session foo :async
export GREETING="Hola"
#+END_SRC

#+RESULTS:


#+BEGIN_SRC sh :session foo :async :results output raw
[[ -n "$GREETING" ]] && echo "$GREETING" || echo ":session is not respected"
#+END_SRC

#+RESULTS:
Hola

Current behavior

#+BEGIN_SRC sh :session foo :async
export GREETING="Hola"
#+END_SRC

#+RESULTS:


#+BEGIN_SRC sh :session foo :async :results output raw
[[ -n "$GREETING" ]] && echo "$GREETING" || echo ":session is not respected"
#+END_SRC

#+RESULTS:

:session is not respected

error in process sentinel: Cannot open load file: No such file or directory, org-version.el

I installed from melpa in doom.emacs, with
(package! ob-async) in package.el
and (require `ob-async) in config.el

when run

#+BEGIN_SRC shell  :async
ls /
#+END_SRC

#+RESULTS:
: 5c2fdbddee3db775041e18d58df9ae2f

and report error message

executing Shell code block...
error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, org-version.el
error in process sentinel: Cannot open load file: No such file or directory, org-version.el

Emacs 26.3
Kubuntu 19.10

Output of stderr

Expected Behavior

With async enabled, output the error produced just like without async.

Actual Behavior

Empty results with no errors.

Steps to Reproduce

#+BEGIN_SRC sh :async
date -q
#+END_SRC

When run without async, produces error, with async, nothing produced.

Can't exec ob-async due to `error in process sentinel: async-handle-result: Invalid read syntax: "#"`

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

#+RESULTS in buffer should change to actual result.

Actual Behavior

#+RESULTS in buffer changes to token but does not change to actual result after that.
ex.

#+RESULTS:
: 2d182a9f90d63cded606c28e8182894c

Steps to Reproduce

All :async is not working now...

Troubleshooting Artifacts

  • emacs-async should be working. (from gist)
  • Error message returned in Message buffer is following
error in process sentinel: async-handle-result: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"

troubleshooting.org gist

Typo in ob-async-org-babel-execute-src-block: Symbol’s function definition is void: -if-let

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Should just work without a error about void function.

Actual Behavior

Got: error in process sentinel: Symbol’s function definition is void: -if-let

Steps to Reproduce

See the troubleshooting.org file linked below in a gist for my analysis. See the very end of it.

Side note: the troubleshooting.org file references the need to manually update a hook function, but the code indicates that is not needed. installing the package from Melpa did not automatically update a hook function and I conclude the troubleshooting.org file is out of date with what is actually required.

Troubleshooting Artifacts

Here is the link to my copy of the troubleshooting.org file: https://gist.github.com/bgoodr/ae0e048bb5fe6e660bfff3ac96744cf8

:noweb yes breaking ob-async with error in process sentinel: Invalid read syntax: "#"

Checklist

  • I followed the troubleshooting guide and it did not address my issue

  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer

  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

Async execution working or at least only failing once when using :noweb yes

Actual Behavior

After executing a code block with :async and :noweb yes, all subsequent executions with :async fail with error

error in process sentinel: async-when-done: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"

Steps to Reproduce

execute

#+begin_src shell :async
echo ff
#+end_src

=> this should work asyncronously

execute

#+begin_src shell :async :noweb yes
echo ff
#+end_src

=> this fails with "Invalid read syntax: "#"

now

#+begin_src shell :async
echo ff
#+end_src

also fails and keeps failing until restarting emacs.

I have tried the workaround that was suggested in #75

(defun no-hide-overlays (orig-fun &rest args)
  (setq org-babel-hide-result-overlays nil))

(advice-add 'ob-async-org-babel-execute-src-block :before #'no-hide-overlays)

but no difference

Troubleshooting Artifacts

https://gist.githubusercontent.com/bschwehn/0d36feaa9c0c681295eb4b955da90919/raw/9feca662ccdcb685c84bcd65a37be7b7b83b7b22/troubleshooting.org

ob-async does not respect Org 9.2 new :results file link

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

The result link of file should not be overriden by process output. It's just a link to file.

#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file "clj-new/README.md" :async
if [ -d clj-new ]; then
  cd clj-new ; git pull
else
  git clone --recursive https://github.com/seancorfield/clj-new.git clj-new
fi
#+end_src

#+RESULTS[<2019-01-30 17:45:40> 7e8b186da3d33354172f44ce8cc54416b3fe0405]:
[[file:data/code/clj-new/README.md]]

Actual Behavior

The result link of file is overriden by process output.

#+begin_src sh :mkdirp yes :results file link :dir "data/code" :file "clj-new/README.md" :async
if [ -d clj-new ]; then
  cd clj-new ; git pull
else
  git clone --recursive https://github.com/seancorfield/clj-new.git clj-new
fi
#+end_src

#+RESULTS[<2019-01-30 17:45:40> 7e8b186da3d33354172f44ce8cc54416b3fe0405]:
[[file:data/code/clj-new/README.md]]

I tested without :async. It works fine. Once I added :async, it works wrong.

Steps to Reproduce

Troubleshooting Artifacts

ob-async does not seem to support ob-ref

Checklist

  • I followed the troubleshooting guide and it did not address my issue
  • I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer
  • Each section below is filled in and includes sufficient detail to reproduce the issue

Expected Behavior

#+NAME: table
#+begin_example
    aaaa
    bbbb
#+end_example

#+begin_src shell   :stdin table :async
    grep a
#+end_src

#+RESULTS:
: aaaa

Actual Behavior

Debugger entered--Lisp error: (error "Reference `table' not found in this buffer")
  signal(error ("Reference `table' not found in this buffer"))
  async-handle-result((lambda (result) (with-current-buffer #<buffer ansible.org> (let ((default-directory "/Users/bytedance/org/")) (save-excursion (cond ((member "none" ...) (message "result silenced")) ((member "silent" ...) (message ...)) (t (goto-char #<marker at 8485 in ansible.org>) (let ... ... ... ...))) (run-hooks 'org-babel-after-execute-hook))))) (async-signal (error "Reference `table' not found in this buffer")) #<buffer *emacs*>)
  async-when-done(#<process emacs> "finished\n")

Troubleshooting Artifacts

So i read the source code of ob-shell to figure out where (error "Reference 'table' not found in this buffer") were produced.

(defun org-babel-execute:shell (body params)
  "Execute a block of Shell commands with Babel.
This function is called by `org-babel-execute-src-block'."
  (let* ((session (org-babel-sh-initiate-session
		   (cdr (assq :session params))))
	 (stdin (let ((stdin (cdr (assq :stdin params))))
                  (when stdin (org-babel-sh-var-to-string
                               (org-babel-ref-resolve stdin)))))
(defun org-babel-ref-resolve (ref)
  "Resolve the reference REF and return its value."
  (save-window-excursion
    (with-current-buffer (or org-babel-exp-reference-buffer (current-buffer))

The Problem is that org-babel-exp-reference-buffer and (current-buffer) inside async child process are both nil
It's pretty odd because ob-async-org-babel-execute-src-block has injected that variable.
Then I add some code like below to make sure org-babel-exp-reference-buffer is not nil before calling async-start

(let* ((....)
       (org-babel-exp-reference-buffer (current-buffer))
       (cmd (intern (concat "org-babel-execute:" lang)))
       result)
  ....
    (async-start .... ))

But that's all I got.

error in process sentinel: async-handle-result: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"

Does anyone know the reason for this error?
Apart from saving the buffer to a temporary file, is there a way to inject buffers for async child process?

I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous

I wanted to create this issue/feature request in the org mode
repository, but the org mode repository is not hosted on github.
So I'm using this github.com/astahlman/ob-async
repo for this issue.

This issue/task is about extending the emacs text editor
(or one of its plugins such as this ob-async) -
to make it more user friendly.
There's no single right solution. I'm not even sure if this is
the right repository to tackle this.

I want shell code blocks executed via emacs org babel to be
a) verbose - output should be shown live
b) stoppable
c) interactable
d) asynchronous (https://github.com/linktohack/ob-async does this)

The ideal solution should be language agnostic, so that python/ruby/whatever
code blocks can have the same facilities.

Background:
Please familiarize yourself with
Emacs https://en.wikipedia.org/wiki/Emacs
org-mode https://en.wikipedia.org/wiki/Org-mode
https://code.orgmode.org/bzg/org-mode
babel https://orgmode.org/worg/org-contrib/babel/
https://www.youtube.com/watch?v=dljNabciEGg
https://emacs.stackexchange.com/search?q=ob-async
If you get stuck, ask on emacs.stackexchange.com

Details:

Press Control-C Control-C to execute this code block

#+BEGIN_SRC sh :results output raw
echo 'hello world'
#+END_SRC

You should get the result

#+RESULTS:
hello world

Now execute this block

#+BEGIN_SRC sh :results output raw
sleep 60
#+END_SRC

Now emacs is unresponsive for 60 seconds.
What's needed: Provide the ability for user to kill
the process by pressing a keyboard shortcut.
Use Control-c Control-k if thats available.

Execute this block
#+BEGIN_SRC sh :results output raw
for i in $(seq 10); do echo "This is echo number: $i"; sleep 1;done
#+END_SRC
You should get this result

#+RESULTS:
This is echo number: 1
This is echo number: 2
This is echo number: 3
This is echo number: 4
This is echo number: 5
This is echo number: 6
This is echo number: 7
This is echo number: 8
This is echo number: 9
This is echo number: 10

What's needed: We want to show the output line by line
"live". Try the code block on a vanilla terminal
and you will see the echo happening every second for ten seconds.
Don't forget STDERR. Both STDOUT and STDERR output should
be made visible to the user.

I want to suggest a window-split to display the output. For an example
of something like this, try using the "rubocop-check-project" provided
by this package: https://github.com/rubocop-hq/rubocop-emacs

Try this block

#+BEGIN_SRC sh :results output
echo -n "Enter your name and press [ENTER]: "
read name
echo "you said $name"
#+END_SRC

In a case like this, in the minibuffer or a split-winodow, emacs should wait for me the user
to provide the input.

Try this block

#+BEGIN_SRC ruby :results output
puts "Enter your name and press [ENTER]: "
$name = gets
puts "you said $name"
#+END_SRC

In a case like this, in the minibuffer or a split-winodow, emacs should wait for me the user
to provide the input.

It would be nice to be able to interact with REPLs.

#+BEGIN_SRC ruby :results output
require 'byebug' #assumes you did gem install byebug
puts "hello world"
byebug # a breakpoint in ruby > 2.0
puts "passed the breakpoint"
#+END_SRC

When executing the above code, users should be able to interact
with the REPL that appears when the "byebug" line is hit.
Users would exit the repl by typing c for continue.
(This c shortcut is a byebug builtin)

If possible please test your solution on EMACS (HEAD version)
MacOS (latest version)
with Emacs Prelude (latest version).

Any questions, don't hesitate to ask.

Support running blocks sequentially with org-babel-execute-subtree

With the following org-mode file:

* test
** foo
#+begin_src shell :async t
sleep 3
echo foo
#+end_src
** bar
#+begin_src shell :async t
echo bar
#+end_src

With point at beginning of buffer, type M-x org-babel-execute-subtree RET. Source code blocks are now evaluated in parallel, such that the result below the second header (bar) shows up before the first (foo).

Please consider adding support for sequential evaluation of source code blocks with org-babel-execute-subtree.

presented example is not working

When trying the example presented on the readme page, I got no results.
Instead, the Warnings buffer pops up with a message:

Warning (emacs): ob-async-org-babel-execute-src-block is no longer needed in org-ctrl-c-ctrl-c-hook

it seems the source was never executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.