Open stardiviner opened 3 years ago
Seems the CI build check timeout?
This patch seems break ob-async function. Somebody have any idea to improve it?
Gentle ping ...
Hi, I've only just started looking at this repository, and it's not entirely clear to me what you're trying to do with this commit - I've taken the with-temp-buffer example, changed the "< source block >" string so it actually calls a subprocess, but don't run into any errors. Can you give clearer instructions to reproduce the problem you're seeing?
Here is my config code try to auto execute Org Mode "EVAL" property's value.
;;; auto evaluate inline source block in property "EVAL".
(defcustom org-property-eval-keywords-list '("EVAL")
"A list of property keywords for evaluate code."
:type 'list
:safe #'listp
:group 'org)
(dolist (prop org-property-eval-keywords-list)
(add-to-list 'org-default-properties prop))
(defun org-property-eval-code (&optional state)
"Evaluate Org inline source block in property value."
(when (memq state '(children subtree))
;; TODO: detect property keywords in `org-property-eval-keywords-list'.
;; (require 'seq nil t)
;; (seq-intersection ... org-property-eval-keywords-list)
(if-let ((inline-src-block (org-entry-get nil "EVAL" nil)))
(with-temp-buffer
(insert inline-src-block)
(goto-char (point-min))
(require 'ob-async nil t)
(setq-local org-babel-default-inline-header-args
'((:results . "silent") (:async . t)))
(let* ((context (org-element-context))
(src-block-info (org-babel-get-src-block-info nil context))
(type (org-element-type context)))
(when (eq type 'inline-src-block)
(org-babel-execute-src-block nil nil src-block-info))))))) ; <----- HERE
(add-hook 'org-cycle-hook #'org-property-eval-code)
Here is the "EVAL" property value looks like:
*** Spring Breeze Ten Miles 2017
:PROPERTIES:
:EVAL: src_sh{mpv "/path/to/a/media/music.mp3"}
:END:
My Org startup is all folded. So when I put point on this header, and press [TAB]
to expand it, with my upper config, Emacs will use ob-async to auto play it. After play music command exit, it will raise warning message:
error in process sentinel: save-current-buffer: Selecting deleted buffer
error in process sentinel: Selecting deleted buffer
I force pushed commit which really fixed my issue, no error message error in process sentinel: save-current-buffer: Selecting deleted buffer
now.
@astahlman, can you review my PR?
When ob-async execute source block in a temp buffer with
with-temp-buffer
. Like this:I use this implement extension to auto evaluate org inline source block which defined in org property named "EVAL" like this: