From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 8HfCOeXnvmVfFwEA62LTzQ:P1 (envelope-from ) for ; Sun, 04 Feb 2024 02:27:02 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 8HfCOeXnvmVfFwEA62LTzQ (envelope-from ) for ; Sun, 04 Feb 2024 02:27:02 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=O120MLIx; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707010021; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Navn/6q1wOd+citEsMgzoQYH3uvKSAWFWf8dpx4RdDU=; b=U81TNtNPZSuKqWub4P8p8Tc/PTxFbGlZspVL5SMZXG3wxornPgOeI8/nWA1Qg7/Haq7MyT tB7rmMUJe1s0Qt2wNwZ7NDGM7jfQew+WumJDlq8j8Fg/lurxWRy6vZsturbSXEbKpTyOCB kN+9xK4YX4dNuwB6VRaSn1R5tw6GdMnMLho2tnt3dZepWaY0nzZxSzBIJ/NfSWlnZkP29Q L/oDeN+Fj1Sc9uPWj2kUGV9iKA8LlzJt7o4h0l5ZmX0pMTQhycx9T07xsKsvVxi0kVsnWY 4brI5riSQZxnJVEhON2sdkfF9Aqoh7UywvK2j0FysCLPa80awB04T9DPqcdUsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=O120MLIx; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707010021; a=rsa-sha256; cv=none; b=hljWr+S3wt8sGYaBJzTWJS8lymV8asbm65q3caDOqza84WiNqMQQxOFhWRo1oe2e3PTmor mbSNbfGj2LHSnZ0O2SZz97VBlsW8rt4mEnnEU521x5fFK3wGm0segs9pqhAmO5SvphyhSn wF1RvPtySjNtjwQ+P73mcsoVmDP/eKtWBy8q8qWcHbU+ZFbfUVF0fEweaxovOc/TXV44L4 UUVY8/N2G+hWBPl/z0+HbPIjDxXXzZs3uvYTTsROUeth9850ybLwouF7p1bOxmgfDBT7s0 zNyaAN+MfrAxn405ZirE2Cl/LkxP31yQopobvQurf7tYTBleLGWX9k+LGDqroQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8F12867C8A for ; Sun, 4 Feb 2024 02:27:01 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWRGu-0008Ph-T7; Sat, 03 Feb 2024 20:26:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWRGs-0008OR-JJ for emacs-orgmode@gnu.org; Sat, 03 Feb 2024 20:26:10 -0500 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWRGq-0004dS-O0 for emacs-orgmode@gnu.org; Sat, 03 Feb 2024 20:26:10 -0500 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5ce2aada130so3100275a12.1 for ; Sat, 03 Feb 2024 17:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707009967; x=1707614767; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Navn/6q1wOd+citEsMgzoQYH3uvKSAWFWf8dpx4RdDU=; b=O120MLIxucuqLoiSiOYU8JCASJyEeW0htajM/BrIj3Libf4TyjktYjqR8inRVsyKql ZIu69yTxz9ZDSTPbrQz9ZECgal0deXAjs4B8eT1joSufqpF3u0of+FqdjwICpTt20I9b mrieKCCoj8RN2Ovl43k+PFdR4tm+vxEi3I+TiqRzYEawbyhkSBmoeP22e4jirqBaZZbV fz3WsOj/HLbfYv442HoQIqnGfL3LQnsSKZEIOKuMIZUCJVJLo3fTmm2IckqFL2kwTQQr kGLmIw7m6r7ZX4QEdFS8ACbWrFNOAkOppmJjEFo6WNvh02SaI/PJB1vVQmzjapworUJj yTXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707009967; x=1707614767; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Navn/6q1wOd+citEsMgzoQYH3uvKSAWFWf8dpx4RdDU=; b=BIiLz5baJddqO6skBIai1vgifpIJTbtiZhBECjhMiSiKe4dcqz/jr6WuJ3TWnuE7V3 7J2G1bbbc0cnkxl22gHaReqcoKDcPpNS5Fn5hg4vQwnZMHcxZoYVwfBwkTo72eVolKSN I/PbPS6vP+q6Yv2hZJmv6nCILpF9LkN2I6u0Me3FvIiDA801Jxu+Fnp8TkEl5hQ69eXz KG63CDItGaCBFurTy43hDHnyYsgn95HPEzAaqueqwysn9PnOCxRhv39B1+AUZcmdM7hP H1iwbZefUvKkBRgIqTjy3aStnvDskwBzlEMfLeHs3St0KE4Bv8jPa2viH78yi5NSaA0B /4xQ== X-Gm-Message-State: AOJu0YySwVlqCF9YvFrNOqfQRV3+maXftxIzGCuiRxSSwbEcRgkBqmyV ZyY9cIISeSCH8YVX8C5Lek0l0ZUt94wsabgrm9IZ9JDdA3pqdPc9 X-Google-Smtp-Source: AGHT+IH18mN675/d+RU8I3zDh7k3y2pv/Pwq45tEjFQmv7Wn+GThQKBll/mbDPqhchC2Fn0S1GGhig== X-Received: by 2002:a17:903:2452:b0:1d8:ef38:f9c7 with SMTP id l18-20020a170903245200b001d8ef38f9c7mr13905043pls.22.1707009966426; Sat, 03 Feb 2024 17:26:06 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVax2mWw3GuKQD01+im9EWUxayfIncfx9BMevKY0VnImPT0ByRQeMutl0oOUGIdy0dcPnrmzNP7+rq0zROXJ6MoRksQXMM= Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id k5-20020a170902e90500b001d7907eb711sm3743298pld.182.2024.02.03.17.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:26:05 -0800 (PST) From: Jack Kamm To: Ihor Radchenko Cc: Nasser Alkmim , emacs-orgmode@gnu.org Subject: Re: Async Python src block behavior with :dir header property In-Reply-To: <87plxdmtq3.fsf@localhost> References: <87il3a55bg.fsf@gmail.com> <8734udvjai.fsf@localhost> <86plxhely9.fsf@gmail.com> <8734udoejo.fsf@localhost> <86y1c5cztv.fsf@gmail.com> <875xz9o4nj.fsf@localhost> <87plxg95u4.fsf@gmail.com> <87msskmm47.fsf@localhost> <87mssi8ht2.fsf@gmail.com> <87plxdmtq3.fsf@localhost> Date: Sat, 03 Feb 2024 17:26:04 -0800 Message-ID: <87bk8x81g3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=jackkamm@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.98 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -9.98 X-Migadu-Queue-Id: 8F12867C8A X-TUID: WiWnCj+2Hfo7 --=-=-= Content-Type: text/plain Ihor Radchenko writes: >> I agree it's a problem -- if there are multiple blocks with the same >> session but different ":dir" arguments, then a ":file" result of the >> second block will be relative to the wrong :dir. >> >> This seems like a longstanding problem, and affects both async and >> non-async session blocks. > > Maybe something like the attached? Nice, that seems like the right way to do it. I updated the patch for `org-babel-comint-async-filter' to follow the same approach, setting default-directory based on the session buffer's value rather than the :dir header arg. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ob-comint-Make-file-results-from-async-sessions-resp.patch >From 1a1a22e4f4a12ebe83c3fef26fe727066fb14476 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 7d258ea0e..349524701 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -224,6 +224,8 @@ (defun org-babel-comint-async-filter (string) (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 @@ -248,7 +250,8 @@ (defun org-babel-comint-async-filter (string) (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 @@ -291,7 +294,8 @@ (defun org-babel-comint-async-filter (string) (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)))) -- 2.43.0 --=-=-=--