From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aFg7OzbVGmReXAEASxT56A (envelope-from ) for ; Wed, 22 Mar 2023 11:15:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kFdBOzbVGmQDnQAA9RJhRA (envelope-from ) for ; Wed, 22 Mar 2023 11:15:18 +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 8FC2D109DF for ; Wed, 22 Mar 2023 11:15:18 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=CzvpQH2G; 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679480118; 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=oRU3UQ8GO9rtrsXE7CFjx4l6h2NGW9CvpKnEXHD2oPE=; b=mEqOHGud9/3hqtkEze09B/diFwVm+P95cpaRIhoXCnUvb1Ar6IoUJ/sqJnzm7pudC03FkR wWE5oQhJTrLs+6vdlPUyMS4W8+DPUvUfEkOZgDA8triKmFmJwij7an77+f5E13nRHhg+38 dE58v8iLU3Tlu22X4Y49qZ+jtzn2vL0ufbvEbRdPZuObMLphsEBzQisx0tXAoudikULzou fqA7BMRC2DLbFRCUzUJouPwiSP4cLU0ZaokfbFQXal3E7Il0QMOCE/6ZbAnbB1TQzYBw5J iXdqibMrDAK7oupuBxEaVdpffDQjSaaFBVsBWX2Hdy34E8UscS5A9X1PC0NZEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679480118; a=rsa-sha256; cv=none; b=fCX6hVas58pKp1Sfdbv/Mks/lUAtAdbktWrJE4LMmXoiB9LS9GlOAQN9m+e9LFVJHhq+ij 9LekqFi9Rkqdvs6euUpZdrlMHnD581cdJOomXGd/LczEkhk1RfbhLviqrh/I2Lp4R0OR4Q 3GygiN8EfAVoLZq7S3681tvYbcSkq6mKG4qkUf/78QBAu65rlkOOpbX0MwgdbSocJWN8iz Nu71VwIDTdrOyhxQq8VH7BBKREQKKAhyTXAi/yyTuxY4YNX1yVl/g65zX20GMsxe5tk0Bs 2EVJ3/ME+mmdPqm+rIaR5rcBf6irSLwqOLAYTqUHxP9OXl1HlHGkbSHvYcslRg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=CzvpQH2G; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pevTy-0007Ar-AQ; Wed, 22 Mar 2023 06:14:14 -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 1pevTw-0007AW-8I for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 06:14:12 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pevTt-0001Cb-Vw for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 06:14:12 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id D944D2407AF for ; Wed, 22 Mar 2023 11:14:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679480047; bh=uPzb/iFkkKe/1oGYVjXqj7i9Y73qXP7uItsEYYfwVH8=; h=From:To:Cc:Subject:Date:From; b=CzvpQH2GccYCJLqvWemX0Bf8L5EUdACuaeEHKVfCdTgTZ2zDqkDK1jg3rYABiWIVt 99GdUsdO8Wcdw5UGQByEjnAH/nOX76XsPgB7Cv0TpMSm+cOUrc2QX7mJVxwgD3tqa4 /QeTnvO3a2TATpK2Ed0WjUSYq9JUPLn1hAEVuP4pNLKOJ1/to888ygkRKT07Zao2OH 5QUtwP/x1SZepw/CcdkI6cX1khmRQ5hpR2eYU9P9+Y7hDnSEVUJg09qECsI2b/fBTy ZBYB9ok9R0KiQoFrfLQDBKxBe2dCi3gqzqfVvOXfsdLmpDGCPhVpEhJRsbn4Mw3XUy 2x4gHPdFPkwgw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PhPTB0GVVz6tn0; Wed, 22 Mar 2023 11:14:05 +0100 (CET) From: Ihor Radchenko To: Bruno Barbier Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add tests for ob-haskell (GHCi) In-Reply-To: <6416e4d9.df0a0220.ce03d.5c4b@mx.google.com> References: <6416d214.5d0a0220.d9c1.54aa@mx.google.com> <875yaxvy93.fsf@localhost> <6416e4d9.df0a0220.ce03d.5c4b@mx.google.com> Date: Wed, 22 Mar 2023 10:16:02 +0000 Message-ID: <87h6udozvh.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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: X-Migadu-Scanner: scn0.migadu.com List-Post: X-Migadu-Queue-Id: 8FC2D109DF X-Spam-Score: -6.57 X-Migadu-Spam-Score: -6.57 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 X-TUID: 2HuGxOs4ZtR6 --=-=-= Content-Type: text/plain Bruno Barbier writes: > Ihor Radchenko writes: > >> From a first look, random failures appear to be related to session >> initialization. > > My function 'test-ob-haskell-ghci' should protect against that; it > ensures the "*haskell*" buffer is always new. From what I understand, > this is an input buffering problem: inputs are not full lines. I see. We can try the attached patch. Yet another edge case in comint, it appears. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-babel-comint-with-output-Handle-agglomerated-pro.patch >From 2bdcec1e1f9a3ce0314d182a4c50887e8ec80a17 Mon Sep 17 00:00:00 2001 Message-Id: <2bdcec1e1f9a3ce0314d182a4c50887e8ec80a17.1679480064.git.yantar92@posteo.net> From: Ihor Radchenko Date: Wed, 22 Mar 2023 11:12:30 +0100 Subject: [PATCH] org-babel-comint-with-output: Handle agglomerated prompts better * lisp/ob-comint.el (org-babel-comint-with-output): Consider that comint can sometimes agglomerate multiple prompts together even within a single output increment as passed to `comint-output-filter-functions'. Example in GHC comint buffer: GHCi, version 9.0.2: https://www.haskell.org/ghc/ :? for help ghci> ghci> :{ main :: IO () main = putStrLn "Hello World!" :} main "org-babel-haskell-eoe" ghci| ghci| ghci| ghci> ghci> Hello World! ghci> "org-babel-haskell-eoe" ghci> --- lisp/ob-comint.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index 54bf5127e..e167d911b 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -91,7 +91,16 @@ (defmacro org-babel-comint-with-output (meta &rest body) ;; trailing newline. Use more reliable ;; match to split the output later. (replace-regexp-in-string - comint-prompt-regexp + ;; Sometimes, we get multiple agglomerated + ;; prompts together in a single output: + ;; "prompt prompt prompt output" + ;; Remove them progressively, so that + ;; possible "^" in the prompt regexp gets to + ;; work as we remove the heading prompt + ;; instance. + (if (string-prefix-p "^" comint-prompt-regexp) + (format "^\\(%s\\)+" (substring comint-prompt-regexp 1)) + comint-prompt-regexp) ,org-babel-comint-prompt-separator text)))) comint-output-filter-functions)) -- 2.39.1 --=-=-= Content-Type: text/plain >> It appears that ob-haskell is re-using sessions even >> if :session is nil (default). And multiple session not allowed?? (I am >> looking at `org-babel-haskell-initiate-session', which ignores session >> parameter completely). > > From what I understood, the buffer "*haskell*" is coming from > haskell-mode. And, to make it work might require some changes there too. >From my reading of haskell-mode, it seems to be safe if we simply rename Haskell process buffer upon session initialization. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--