From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id ePKeD8OWFWSdbAAASxT56A (envelope-from ) for ; Sat, 18 Mar 2023 11:47:31 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +J7mDsOWFWSyBAEAG6o9tA (envelope-from ) for ; Sat, 18 Mar 2023 11:47:31 +0100 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 43AAB136D9 for ; Sat, 18 Mar 2023 11:47:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdU5I-0000sx-Im; Sat, 18 Mar 2023 06:46:48 -0400 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 1pdU5H-0000sj-9k for emacs-orgmode@gnu.org; Sat, 18 Mar 2023 06:46:47 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdU5E-0004LC-PR for emacs-orgmode@gnu.org; Sat, 18 Mar 2023 06:46:46 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 99800240391 for ; Sat, 18 Mar 2023 11:46:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679136401; bh=zx0jhcM1k28VJ1lMIHG0x73M85wpI9edryDRE7rLUUQ=; h=From:To:Cc:Subject:Date:From; b=NrlwpPYw4wsu2AFNDYFpd2cSnWHAopVvG8tTzKVIELNYlFFCGBMFi3C5DuHNGQkFm Kzat0lV6xKY+2jKekHnAnVGymfdhwJfKaH0OcGNzex3j08y9w2PQwTq1aA7GQtEwhF c6AH/bSx74Yv7RdEwmRY14JtZsdOXNATv1Fqf0KrReWb+ix7YWZRd8q3JZvKR0T/d1 dsBiZjvvBj4Pl9D9VkHX2TvlLcRleKrXrZZyAiAgIAxZOVaoUlmNk0E/EJzDOyavrD Bis41n5Plm1JR+EZ3MQONsWP7gv4BQjM87cW6qBcjZmyVBcm7ThIB+m+V57TLhyvwg whqD7/zQV44IQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PdyNY3ytmz6tnD; Sat, 18 Mar 2023 11:46:37 +0100 (CET) From: Ihor Radchenko To: Matt Cc: emacs-orgmode , jeremiejuste , jackkamm Subject: Re: [PATCH] Async evaluation in ob-shell In-Reply-To: <186c771ebdb.fadb25d63466542.8590370552765842508@excalamus.com> References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com> <87v8kd8zzw.fsf@localhost> <1863472efe9.10fdd5ba4258906.5972264927968042941@excalamus.com> <87y1p7axpe.fsf@localhost> <1863d69188f.11e078bd1228881.451172865246440158@excalamus.com> <87fsbcbf47.fsf@localhost> <186471d8980.c36aecd0374444.2548279362371712281@excalamus.com> <87sff73r0g.fsf@localhost> <18658639a30.dec640641420614.2364646537016397698@excalamus.com> <87lekwd10z.fsf@localhost> <1866bf50874.bc4ef1a92164564.1238825567948423531@excalamus.com> <87r0ukefzv.fsf@localhost> <1866fda933d.cf33745c2396994.7118762013608820270@excalamus.com> <87sfeyc7qr.fsf@localhost> <1869ff63e3e.f8c4ed671354538.4585567073216319262@excalamus.com> <87bkl96g6e.fsf@localhost> <186a89b5a24.cc4913fe1885630.21323979015166045@excalamus.com> <87ilffz95g.fsf@localhost> <186b5aa9d56.1238923db2169250.3173443400140454866@excalamus.com> <87ttywg26t.fsf@localhost> <186c771ebdb.fadb25d63466542.8590370552765842508@excalamus.com> Date: Sat, 18 Mar 2023 10:48:27 +0000 Message-ID: <873562z66c.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NrlwpPYw; 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=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679136450; a=rsa-sha256; cv=none; b=fiDikTlIHFoeR1bjAqALmicbmzXVvmSIw3TXb5MEysTycftpFaev/hq/OBieGOH8dHcmE2 3gBhNZQnlcKCPFZ/o85cYfLp7gxUlUeaOQ2V60jH1Oe9pEFiNbhw59ecYWf0XjjcpEv6nP XEIx6sByvpZCHqa/3YGCK6uxBc5wi+hiFupjxpIqXUoBvNvjLaOjUlBRhW6rzKrzTA0788 RBTEbh+7PDeFuSoMN5u4ZafN8i0n1B+i+zqI3QTHZSfxtyYPKdkIXrX/cmGtcfsGWsqAjO s2KLMekCBsiybc4lKb2cR9MXgwL1mdUxQCCW++HoqhUpDQrn9c83A6szDW+KSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679136450; 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=WeMfTiNEutfGxZb4sjmH6iqCA6iWieR4h1fb7ZmhdfM=; b=R6MqdKLAnvuvjRtqSKV/jXZEP37K0gIJlQCr8tHUhcFlpd+t74UaiWX/ZkvKq/pOfzsHNo klzTmQYAuhkO9wtW9fkstANM7AUqnS0t+i77z2bSXXO3E0jam59CZts8t4AN7d7wIAuQTI bLJTlkVGdIVEwmLkncTSjT+V0xd+sh4T0hFw1mblWm/Wtd/JJUytMlhU7T5lcMrccwkhN6 b0DHbPQYYCtu6Az1orSTOx6GZiNtGzTLh886++lEUmpv0bI5qJ+amothWnB9qdoN4kKqVf 37JCel1dpD3lmkgwXS4aYjn7s3vksSv8gaQLCgItffXMoOZmshhExcho60pycA== X-Migadu-Spam-Score: -6.27 X-Spam-Score: -6.27 X-Migadu-Queue-Id: 43AAB136D9 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NrlwpPYw; 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=posteo.net X-TUID: 2QAQCmgbaM0O Matt writes: > Way back in https://list.orgmode.org/87sfeyc7qr.fsf@localhost/, we had this exchange: > > ---- On Mon, 20 Feb 2023 11:24:52 +0000 Ihor Radchenko wrote --- >> Matt writes: >> >> > +(defun ob-shell-async-chunk-callback (string) >> > + "Filter applied to results before insertion. >> > +See `org-babel-comint-async-chunk-callback'." >> > + (replace-regexp-in-string (concat org-babel-sh-prompt "*") "" string)) >> > > Why not using `comint-prompt-regexp'? > > I switched out `org-babel-sh-prompt' with `comint-prompt-regexp' so that the expression looks like: > > +(defun ob-shell-async-chunk-callback (string) > + "Filter applied to results before insertion. > +See `org-babel-comint-async-chunk-callback'." > + (replace-regexp-in-string comint-prompt-regexp "" string)) > > This causes the new test `test-ob-shell/session-async-evaluation' to fail, as you pointed out: https://list.orgmode.org/87bkl96g6e.fsf@localhost/ > > The test fails when we switch out the prompt in the callback because `comint-prompt-regexp' has two spaces in it. The second space causes a prompt to not be filtered (by the callback). The output becomes ": 1\n: 2\n: org_babel_sh_prompt>\n" instead of ": 1\n: 2\n" . This looks like a bug in the `comint-prompt-regexp''. No, this looks like a bug in comint.el. ob-shell correctly sets PROMPT to be org-babel-sh-prompt, which is "org_babel_sh_prompt> ", with space! The fact that the comint output does not, in fact, contain space is wrong. We can probably remove the space in org-babel-sh-prompt to work around this (likely, Emacs) bug. > It could be that `test-ob-shell/session-async-evaluation' doesn't test correctly, but it looks right to me (I could certainly be mistaken). Therefore, I see only two options to fix it: remove a space from the concat expression (which I did in my latest patch) or remove a space from `org-babel-sh-prompt'. Removing space from the concat expression in plain wrong, as Max explained. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at