From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WNPzA9VWhGZkhQEAe85BDQ:P1 (envelope-from ) for ; Tue, 02 Jul 2024 19:36:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id WNPzA9VWhGZkhQEAe85BDQ (envelope-from ) for ; Tue, 02 Jul 2024 21:36:53 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=7d.nz header.s=20240212 header.b=qbYIuwbp; dmarc=pass (policy=reject) header.from=7d.nz; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1719949013; 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:dkim-signature; bh=CyNB1OGfjLHIsEfZx/5eWHooEtdwbwEb6sk19o0WM2E=; b=lzrYDKYu2liVZz7GQLZh2Q6Emmm5Sk5+41iTUOqd4ziRNHlD8s+ayYOW7v+y0hhuXpsXx4 lwMpwHfOtVH2bTDKNLQyyg4gXp1h8u6Dt297iKhdqgoxWkIbtWlzLHlfexKvAsJf8Jgc4O CPd+8UesE00pO9gk/Mk8ot/qbXbhrr5fDMMIcoS8dbE8qk78c26RlAQ+NyeKGKWXUesl6T EuuGPj6+SoxCdyIYtTCYe9+LYGH/dYOFYhKgyfzz4WXlKE3Kzh8KNFtISr/ak/DrgRv9Gt P/wBThiPrky6a4OqQsbK4InmtnFQWQ6SguRsQhGlCaJSEDw4KLBUQBZa8jOmRw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1719949013; a=rsa-sha256; cv=none; b=aESfMHSMN18ZQgBnINs3ztMiejRo6kGMYVDTqloB2T1otSGnzRwJg/iXGPffeOqhxv1YP0 MuQamsNf1eDA4C+j1klM6XR+EcFUgnLOTRaN0c4KPfpc2MxoEs+WOWOs2QeORxNOHnhmAl aN5bJOnqBKagW+OOde30mvWeR4cnmvanh6suczKaYqJkjwW0zt0cWjfLiSurwIh+Zd67sJ sEKciJxxJBnNsE14Wa3qUfef6dl0hwDu98W+OxnpGvcGfoJlYcxdGF9YTSsThHLNasnIbd nVbB38D4Fe8VLq1mJpUgk9tc61FhewfSepffAdfmeW5lxEeekasnhoU5XNEbOA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=7d.nz header.s=20240212 header.b=qbYIuwbp; dmarc=pass (policy=reject) header.from=7d.nz; 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" 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 5D525627BB for ; Tue, 02 Jul 2024 21:36:52 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOjIG-0001ny-Fx; Tue, 02 Jul 2024 15:36:00 -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 1sOjIE-0001nb-T7 for emacs-orgmode@gnu.org; Tue, 02 Jul 2024 15:35:58 -0400 Received: from smtp-8fae.mail.infomaniak.ch ([83.166.143.174]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOjI7-0004A9-DI for emacs-orgmode@gnu.org; Tue, 02 Jul 2024 15:35:54 -0400 Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4WDCnF0qHxz19ZB; Tue, 2 Jul 2024 21:35:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=7d.nz; s=20240212; t=1719948945; bh=CyNB1OGfjLHIsEfZx/5eWHooEtdwbwEb6sk19o0WM2E=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=qbYIuwbphjtB8FxjnaJEWwozQXcS9eYo4bg9CKGVbr3G2dxVaaXYvYg5cdZwzxzgL bcZ+gmHRfQwUNztTxa0qf4RKVONDbXCyRFeuEErjSs9P4KMfxWai0PMvekEyvDfzEf ouWwGfwYFcQKjOJB2XKAc//0Vbe9v1VsWNbEay3TasAFn7r/ZY6FvSkyiIeH5j3JWO nIyJgSNssfNbIMOoHy3HOPSRPCxPagwhx3VhPkNU4qVznnaXyOqqxrM/UV+QKEHVS6 FQ/b1LJi3xxO48Ss8LQy4orNkiOkWI/4kBU31SR4JUiNUkFk9zNs8auiH3merCpfjh QdEYTmVa+Kp6g== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4WDCnD4xPkzcSN; Tue, 2 Jul 2024 21:35:44 +0200 (CEST) Message-ID: <5d3c8cce-b79d-43c2-baaa-459fea1ed3d9@7d.nz> Date: Tue, 2 Jul 2024 21:34:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Phil Subject: Re: org-babel-execute-src-block filters characters from :session *shell* output To: Ihor Radchenko , Max Nikulin Cc: emacs-orgmode@gnu.org References: <87ikybk44c.fsf@localhost> <87o782gx7o.fsf@localhost> <87h6dra1ut.fsf@localhost> <874j9al08g.fsf@localhost> Content-Language: fr In-Reply-To: <874j9al08g.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha Received-SPF: pass client-ip=83.166.143.174; envelope-from=pe@7d.nz; helo=smtp-8fae.mail.infomaniak.ch 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, SPF_HELO_PASS=-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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.57 X-Spam-Score: -4.57 X-Migadu-Queue-Id: 5D525627BB X-Migadu-Scanner: mx11.migadu.com X-TUID: dY2guaI/xmei * [2024-06-16 14:47] Max Nikulin: >> On 15/06/2024 20:19, Ihor Radchenko wrote: >>> The underlying cause is a limitation of Emacs API for >>> interactive shells - we cannot easily distinguish >>> command output from prompt and other extra stuff >>> your shell/other interactive command spits into the >>> buffer. >> Some shells support "semantic shell" that allows >> terminal applications e.g. to copy whole command >> output. It is based on escape sequences. >> - https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md >> - http://per.bothner.com/blog/2019/shell-integration-proposal/ > > it is implemented by simply setting PROMPT in a way > that adds these escape sequences to the original > PROMPT value. > one downside will be that the unicode character we > add may be carried along if the user copies the > comint buffer contents. Perhaps a minor-mode would get to the rescue to filter copies? I'd like to add a few general remarks about *error status*. I'm starting to notice there are not much subprocesses that to do get called through =call-process= with ‘(REAL-DESTINATION ERROR-DESTINATION)’ kept as separate. You all know how useful stdin/out/err and the return codes are, but they're absent from Babel. That's why a failed command will still provide a result — an empty array for instance, something that looks legit even when it's not. I had again this experience with =ob-http :pretty= and =ob-mongo= lastly: errors are silenced. Comint reads and write from/to terminals with all three standard channels together. It's meant to provide requirements to communicate with non-POSIX terminals too. It's a great library but perhaps there's a need to specialize things further when dealing with one shell? So In Emacs, those specs would land either in one precise (possibly low-level) shell extension or a generic one that would once more care for the many idiosyncracies every one of them have. Something I figured when dealing with ob-sql-session is that if several commands are given in one batch (what a babel source block is in many cases), they can either be all run until the end or be stopped when an error is met. In both cases, knowing the number of errors met is possible in one shell that do agree with the convention of returning a value for every command (or command line). Otherwise, a terminal "reader" has to reinterpret the results. [[info:elisp#Synchronous Processes][elisp#Synchronous Processes]] says : You can’t directly specify a buffer to put the error output in; that is too difficult to implement. Can someone explain why? Phil