astahlman / ob-async Goto Github PK
View Code? Open in Web Editor NEWAsynchronous src_block execution for org-babel
Asynchronous src_block execution for org-babel
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
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
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.
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
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
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.
I noticed the above message when messing around:
Do you mean 'no longer needed' ?
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
Async execution working or at least only failing once when using :noweb yes
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: "#"
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
This is a copy of #7 as it was closed prematurely.
troubleshooting.org
buffer#+RESULTS
in buffer should change to actual result.
#+RESULTS
in buffer changes to token but does not change to actual result after that.
ex.
#+RESULTS:
: 2d182a9f90d63cded606c28e8182894c
All :async
is not working now...
emacs-async
should be working. (from gist)error in process sentinel: async-handle-result: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"
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!
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.
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?
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!
#+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
#+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
troubleshooting.org
bufferConsider 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
When I press C-c I get RESULTS block changed immediately, the answer y/n does not matter
#+RESULTS:
: 6fc00bde7e0c6b7623f6e3e05c16fbba
troubleshooting.org
buffer#+NAME: table
#+begin_example
aaaa
bbbb
#+end_example
#+begin_src shell :stdin table :async
grep a
#+end_src
#+RESULTS:
: aaaa
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")
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?
troubleshooting.org
bufferHere 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
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")
#+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
(Copy-paste the contents of your troubleshooting.org
buffer into a gist and add the link here)
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 ;)
troubleshooting.org
bufferNOTE
Running async block, replacing result with the results.
error in process sentinel: async-when-done: Invalid read syntax: "#"
error in process sentinel: Invalid read syntax: "#"
I get the same error for all blocks with :async
https://gist.github.com/simendsjo/c39671e029a63c40dce342b446ddf023
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.
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
└────
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?
troubleshooting.org
bufferIf (setq org-babel-python-command "python3")
, then ob-async
executions should use python3
.
ob-async
executions still use python2
.
(setq org-babel-python-command "python3")
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)
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.
troubleshooting.org
bufferAsync returns successfully and placeholder text is replaced with output.
Async calles emacs which either doesn't load or fails, placeholder text never get's updated.
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
My ob-async used to be works fine. But after upgrade to latest "master" branch source code of Org Mode. It does not work anymore.
With async enabled, output the error produced just like without async.
Empty results with no errors.
#+BEGIN_SRC sh :async
date -q
#+END_SRC
When run without async, produces error, with async, nothing produced.
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
Most Emacsers these days use package-install
. It would be nice if ob-async
had a package on MELPA...
troubleshooting.org
bufferC-c C-c should work like before but asyncly
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
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
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.
troubleshooting.org
bufferThe source block should take advantage of :dir
header argument.
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
#+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.
https://gist.github.com/stardiviner/28d9dd594a4de2fa726277c279760387
troubleshooting.org
buffer#+begin_src sh :dir /sudo:: :async
pwd
#+end_src
#+RESULTS:
: /
#+begin_src sh :dir /sudo:: :async
pwd
#+end_src
#+RESULTS:
: c3b1c8c713d89c0548ffb9d9e7bf50cf
It never returns. The process never ends.
#+begin_src sh :dir /sudo:: :async
pwd
#+end_src
troubleshooting.org
bufferWhen 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.
It immediately populates the cell(s) with #ERROR
gimme_that
org-sbe
, such as $1='(org-sbe "gimme_that")
Also, see the requested gist below.
https://gist.github.com/mkrauss/3a908cb8bdf7ac9e0fcd5a660d161d0e
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
troubleshooting.org
bufferOutput correct results
Error, no output
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
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")
troubleshooting.org
bufferuuid 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
Install ob-async + ob-julia
(I'm trubleshooting it and I'll provide better info here)
edit: the problem is ob-julia not ess
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!
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
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
.
troubleshooting.org
bufferThe 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]]
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.
troubleshooting.org
bufferEvaluating 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
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.
#+NAME: sleep
#+BEGIN_SRC shell :async
sleep 2 && pwd
#+END_SRC
#+RESULTS: sleep
: eae1247455e5d35b9eb36671b10a317a
#+CALL: sleep()
#+RESULTS:
: /root
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.
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.
org-ctrl-c-ctrl-c-hook is no longer needed (according to the src) but it's checked in the trubleshoot.org file
troubleshooting.org
bufferThe 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
).
working async blocks
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"
(Copy-paste the contents of your troubleshooting.org
buffer into a gist and add the link here)
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.
troubleshooting.org
bufferob-async
package.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
.GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian
ob-async
via list-packages
and from melpa-stable
#+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
*messages*
buffer.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
Hi,
I tried to run the code from your gif-presentation. It failed with the following error:
error in process sentinel: async-handle-result: Symbol’s function definition is void: org-babel-get-header
Could you help me to solve this problem.
troubleshooting.org
bufferShould just work without a error about void function.
Got: error in process sentinel: Symbol’s function definition is void: -if-let
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.
Here is the link to my copy of the troubleshooting.org file: https://gist.github.com/bgoodr/ae0e048bb5fe6e660bfff3ac96744cf8
troubleshooting.org
buffersql-mode
org-babel block executes with :async
Fails with ERROR: error in process sentinel: Symbol’s function definition is void: org-babel-execute: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.
https://gist.github.com/indigoviolet/dc433a83fa851f3413f291bf850f50ab
troubleshooting.org
bufferI can use #+NAME:
and :var
to pass the result of one block to another block even if the first block is :async
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:
#+NAME: result-value
to store the result of an :async
shell block's execution.:var input_var=result-value
and write code to print the value of that variable in the block.#<process emacs>
or possible #<process emacs <n>>
troubleshooting.org and a direct link to the raw troubleshooting.org file that shows the results of the blocks.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.