From 644bf846d61fb2b772e7607db6aeaaea352f0b35 Mon Sep 17 00:00:00 2001 From: Jack Kamm Date: Wed, 31 Jan 2024 20:06:00 -0800 Subject: [PATCH] ob-comint: Make file results from async sessions respect :dir header * lisp/ob-comint.el (org-babel-comint-async-filter): Set default-directory before calling `org-babel-insert-result' https://list.orgmode.org/875xz9o4nj.fsf@localhost/T/#t --- lisp/ob-comint.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index 26f0c3bf7..1ec84e865 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -267,6 +267,8 @@ STRING contains the output originally inserted into the comint buffer." (file-callback org-babel-comint-async-file-callback) (combined-string (concat org-babel-comint-async-dangling string)) (new-dangling combined-string) + ;; Assumes comint filter called with session buffer current + (session-dir default-directory) ;; list of UUID's matched by `org-babel-comint-async-indicator' uuid-list) (with-temp-buffer @@ -291,7 +293,8 @@ STRING contains the output originally inserted into the comint buffer." (let* ((info (org-babel-get-src-block-info)) (params (nth 2 info)) (result-params - (cdr (assq :result-params params)))) + (cdr (assq :result-params params))) + (default-directory session-dir)) (org-babel-insert-result (funcall file-callback (nth @@ -334,7 +337,8 @@ STRING contains the output originally inserted into the comint buffer." (let* ((info (org-babel-get-src-block-info)) (params (nth 2 info)) (result-params - (cdr (assq :result-params params)))) + (cdr (assq :result-params params))) + (default-directory session-dir)) (org-babel-insert-result res-str result-params info)) t))))