From 2add75401728a02c3fb3634cd2a2e6e508fdea9b Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 12:34:44 +0100 Subject: [PATCH] update ob-async. Signed-off-by: Andreas Gerler --- elpa/ob-async-20180429.1039/ob-async-pkg.el | 2 - .../ob-async-autoloads.el | 11 ++- elpa/ob-async-20180816.1553/ob-async-pkg.el | 2 + .../ob-async.el | 87 +++++++++++-------- 4 files changed, 61 insertions(+), 41 deletions(-) delete mode 100644 elpa/ob-async-20180429.1039/ob-async-pkg.el rename elpa/{ob-async-20180429.1039 => ob-async-20180816.1553}/ob-async-autoloads.el (79%) create mode 100644 elpa/ob-async-20180816.1553/ob-async-pkg.el rename elpa/{ob-async-20180429.1039 => ob-async-20180816.1553}/ob-async.el (67%) diff --git a/elpa/ob-async-20180429.1039/ob-async-pkg.el b/elpa/ob-async-20180429.1039/ob-async-pkg.el deleted file mode 100644 index 732be697..00000000 --- a/elpa/ob-async-20180429.1039/ob-async-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "ob-async" "20180429.1039" "Asynchronous org-babel src block execution" '((async "1.9") (org "9.0.1") (emacs "24.4") (dash "2.14.1")) :commit "4bd85c9065f4b075190ffa5a721b9191bc84d6e9" :keywords '("tools") :url "https://github.com/astahlman/ob-async") diff --git a/elpa/ob-async-20180429.1039/ob-async-autoloads.el b/elpa/ob-async-20180816.1553/ob-async-autoloads.el similarity index 79% rename from elpa/ob-async-20180429.1039/ob-async-autoloads.el rename to elpa/ob-async-20180816.1553/ob-async-autoloads.el index 3afcf9f5..67a4b63e 100644 --- a/elpa/ob-async-20180429.1039/ob-async-autoloads.el +++ b/elpa/ob-async-20180816.1553/ob-async-autoloads.el @@ -1,10 +1,12 @@ ;;; ob-async-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "ob-async" "ob-async.el" (23273 33724 71415 -;;;;;; 292000)) +;;;### (autoloads nil "ob-async" "ob-async.el" (0 0 0 0)) ;;; Generated autoloads from ob-async.el (defalias 'org-babel-execute-src-block:async 'ob-async-org-babel-execute-src-block) @@ -31,11 +33,14 @@ block. \(fn &optional ORIG-FUN ARG INFO PARAMS)" t nil) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-async" '("ob-async-"))) + ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; ob-async-autoloads.el ends here diff --git a/elpa/ob-async-20180816.1553/ob-async-pkg.el b/elpa/ob-async-20180816.1553/ob-async-pkg.el new file mode 100644 index 00000000..bec5f4b2 --- /dev/null +++ b/elpa/ob-async-20180816.1553/ob-async-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "ob-async" "20180816.1553" "Asynchronous org-babel src block execution" '((async "1.9") (org "9.0.1") (emacs "24.4") (dash "2.14.1")) :commit "2470490e6efb3f8efde1702f7986f6e31cc1ab6c" :keywords '("tools") :authors '(("Andrew Stahlman" . "andrewstahlman@gmail.com")) :maintainer '("Andrew Stahlman" . "andrewstahlman@gmail.com") :url "https://github.com/astahlman/ob-async") diff --git a/elpa/ob-async-20180429.1039/ob-async.el b/elpa/ob-async-20180816.1553/ob-async.el similarity index 67% rename from elpa/ob-async-20180429.1039/ob-async.el rename to elpa/ob-async-20180816.1553/ob-async.el index 28139f46..2a149459 100644 --- a/elpa/ob-async-20180429.1039/ob-async.el +++ b/elpa/ob-async-20180816.1553/ob-async.el @@ -5,7 +5,7 @@ ;; Author: Andrew Stahlman ;; Created: 10 Feb 2017 ;; Version: 0.1 -;; Package-Version: 20180429.1039 +;; Package-Version: 20180816.1553 ;; Keywords: tools ;; Homepage: https://github.com/astahlman/ob-async @@ -39,6 +39,16 @@ (require 'async) (require 'dash) +(defvar ob-async-no-async-languages-alist nil + "async is not used for languages listed here. Enables +compatibility for other languages, e.g. ipython, for which async +functionality may be implemented separately.") + +(defvar ob-async-pre-execute-src-block-hook nil + "Hook run in the async child process prior to executing a src +block. You can use this hook to perform language-specific +initialization which would normally execute in your init file.") + ;;;###autoload (defalias 'org-babel-execute-src-block:async 'ob-async-org-babel-execute-src-block) @@ -71,6 +81,11 @@ block." ;; If there is no :async parameter, call the original function ((not (assoc :async (nth 2 (or info (org-babel-get-src-block-info))))) (funcall orig-fun arg info params)) + ;; If the src block language is in the list of languages async is not to be + ;; used for, call the original function + ((member (nth 0 (or info (org-babel-get-src-block-info))) + ob-async-no-async-languages-alist) + (funcall orig-fun arg info params)) ;; Otherwise, perform asynchronous execution (t (let ((placeholder (ob-async--generate-uuid))) @@ -136,6 +151,8 @@ block." (setq exec-path ',exec-path) (setq load-path ',load-path) (package-initialize) + (setq ob-async-pre-execute-src-block-hook ',ob-async-pre-execute-src-block-hook) + (run-hooks 'ob-async-pre-execute-src-block-hook) (org-babel-do-load-languages 'org-babel-load-languages ',org-babel-load-languages) (let ((default-directory ,default-directory)) (,cmd ,body ',params))) @@ -143,41 +160,39 @@ block." (progn (message "result silenced") 'ignore) `(lambda (result) - (switch-to-buffer ,(current-buffer)) - (point-to-register 13) ;; TODO: totally arbitrary choice of register - (goto-char (point-min)) - (re-search-forward ,placeholder) - (org-backward-element) - (let ((result-block (split-string (thing-at-point 'line t)))) - ;; If block has name, search by name - (-if-let (block-name (nth 1 result-block)) - (org-babel-goto-named-src-block block-name) - (org-backward-element))) - (let ((file (cdr (assq :file ',params)))) - ;; If non-empty result and :file then write to :file. - (when file - (when result - (with-temp-file file - (insert (org-babel-format-result - result (cdr (assq :sep ',params)))))) - (setq result file)) - ;; Possibly perform post process provided its - ;; appropriate. Dynamically bind "*this*" to the - ;; actual results of the block. - (let ((post (cdr (assq :post ',params)))) - (when post - (let ((*this* (if (not file) result - (org-babel-result-to-file - file - (let ((desc (assq :file-desc ',params))) - (and desc (or (cdr desc) result))))))) - (setq result (org-babel-ref-resolve post)) - (when file - (setq result-params (remove "file" ',result-params)))))) - (org-babel-insert-result result ',result-params ',info ',new-hash ',lang) - (run-hooks 'org-babel-after-execute-hook)) - (goto-char (point-min)) - (jump-to-register 13))))))))))))))) + (with-current-buffer ,(current-buffer) + (save-excursion + (goto-char (point-min)) + (re-search-forward ,placeholder) + (org-backward-element) + (let ((result-block (split-string (thing-at-point 'line t)))) + ;; If block has name, search by name + (-if-let (block-name (nth 1 result-block)) + (org-babel-goto-named-src-block block-name) + (org-backward-element))) + (let ((file (cdr (assq :file ',params)))) + ;; If non-empty result and :file then write to :file. + (when file + (when result + (with-temp-file file + (insert (org-babel-format-result + result (cdr (assq :sep ',params)))))) + (setq result file)) + ;; Possibly perform post process provided its + ;; appropriate. Dynamically bind "*this*" to the + ;; actual results of the block. + (let ((post (cdr (assq :post ',params)))) + (when post + (let ((*this* (if (not file) result + (org-babel-result-to-file + file + (let ((desc (assq :file-desc ',params))) + (and desc (or (cdr desc) result))))))) + (setq result (org-babel-ref-resolve post)) + (when file + (setq result-params (remove "file" ',result-params)))))) + (org-babel-insert-result result ',result-params ',info ',new-hash ',lang) + (run-hooks 'org-babel-after-execute-hook)))))))))))))))))) (defun ob-async--generate-uuid () "Generate a 32 character UUID." -- 2.47.3