From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uA6pAzUJbmNXSQEAbAwnHQ (envelope-from ) for ; Fri, 11 Nov 2022 09:35:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OD2CAzUJbmM2cwAAauVa8A (envelope-from ) for ; Fri, 11 Nov 2022 09:35:01 +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 85A1B97C8 for ; Fri, 11 Nov 2022 09:35:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otPTb-0006yx-H2; Fri, 11 Nov 2022 03:33:27 -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 1otPTW-0006wC-Jt for emacs-orgmode@gnu.org; Fri, 11 Nov 2022 03:33:22 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otPTU-0004fz-Cw for emacs-orgmode@gnu.org; Fri, 11 Nov 2022 03:33:22 -0500 Received: from tosh-laptop (unknown [IPv6:2a01:e0a:505:3460:1a16:a0c4:3f89:c0d9]) by smtp6-g21.free.fr (Postfix) with ESMTPS id 336BB78032A; Fri, 11 Nov 2022 09:33:16 +0100 (CET) Received: by tosh-laptop (sSMTP sendmail emulation); Fri, 11 Nov 2022 09:39:19 +0100 From: Bruno Barbier To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] org-babel-comint-with-output: incorrect prompt detection [9.6-pre] In-Reply-To: <87sfiq9r75.fsf@localhost> References: <87sfiq9r75.fsf@localhost> Date: Fri, 11 Nov 2022 09:39:18 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=212.27.42.6; envelope-from=perso.bruno.barbier@free.fr; helo=smtp6-g21.free.fr X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, MISSING_MID=0.497, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action Message-Id: 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668155700; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Fhxds7o7qTi6W+Uc+4VEL20Toe1n45bIW38ac8LLXnA=; b=df6iw4G7u1Pg69BndGez+WkJmpq26qQ1LAVnpWmEUhOJPt47b5ovM2hHYe1pZT9MyDVK3i KpWYutriGUgZm65r9mJHgsBg8IMuCkBpk3R5VfVb/KPbAl/PkXWgyfl5DuCp/yoRXwx7yB 2yP//b8yRIxxdEFPrpQpIhPITHrVFjbiW3rBbFjijTVtxWlilcmLw9nkGt1MlaPt6jh41o o09XR9T+qwEadzY7tP3mofmkbLU15ww+Ffa9RfrHVcsBoSZJNEswH4ercNyWvOF15pYlc+ VLLm+rhFGWNRJpg0dM0EFo0hnKrF/zwymfnVW4eXxIVKd07bw8nbpU80Vq0sbQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668155700; a=rsa-sha256; cv=none; b=qm0nAzAMmnP3i95f8EgQiN9pZ1q+2ZaUB62ZFh+flZUpsa7IhvHWhY+SbAOEdUIaSGn9oH YYchjvno9VQVP1P80oYwAgCxHy50MNmMRNaQOFXvcan2W598Crus0DCyGrcY3wopxB5mzX t/YEwh4+cPwX+Aq//yGglATjUs/tiCtqhv9jjZQUp7MxeWfERwiDT8UD+RK/OHbTJEBZg6 hZhiMKV2FvGKUe4/hTwWEA7CAExWlgFP1jxpuj3ZwTEn2xuzeiP5Fh8lZmwlGNmR5bPlFz m5L0SVvaX4U8z89sIv/apiN6rJTY3u8dSnY82hPwCIjIOQvoJRHT/fYiDaSAKw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=free.fr (policy=none); 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" X-Migadu-Spam-Score: 2.17 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=free.fr (policy=none); 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" X-Migadu-Queue-Id: 85A1B97C8 X-Spam-Score: 2.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: yJTRbn871gDc Ihor Radchenko writes: > The problem is that Bash can send incoming text like > > "prompt> " "prompt> " "prompt> output\n". > > "prompt> prompt> prompt> output\n". Yes. And I've seen these "outputs" with ob-haskell too ... > > So, we cannot reliably distinguish your case from other possibly comint > quirks based on newline. > > One possible fix could be replacing `comint-prompt-regexp' one more time > at the very end in addition to `org-babel-comint-prompt-separator'. If I understand correctly, you suggest to do one last replace on the whole text (buffer-string). But, for ob-haskell, the current prompt regex is: "^[[:alnum:].*_() |=CE=BB]*> " =20=20=20=20=20 (it starts with "^") > We must also make `comint-prompt-regexp' more precise to avoid "lude> " > being detected as a prompt. If we need to do that for ob-haskell (when relying on the interpreter), the cleanest way might be to redefine the set of possible prompts. ghci is quite flexible: GHCi, version 8.10.7 :set prompt set the prompt used in GHCi :set prompt-cont set the continuation prompt used in GHCi :set prompt-function set the function to handle the prompt :set prompt-cont-function set the function to handle the continuation = prompt I'll keep thinking about how to solve this. Do we have common design principles and/or generic tests that all languages based on org-babel/ob-comint must pass ? Thanks Ihor! Bruno > > --=20 > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at