From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: comint-output-filter-functions and multi-line input Date: Tue, 18 Oct 2022 06:00:36 +0000 Message-ID: <87k04xfz7f.fsf@localhost> References: <87y1tgqhmc.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5811"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 08:09:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okfnF-0001Jm-8T for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 08:09:37 +0200 Original-Received: from localhost ([::1]:59478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okfnD-0007hF-HV for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 02:09:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okfdx-0006IN-Ef for emacs-devel@gnu.org; Tue, 18 Oct 2022 02:00:04 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:51285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okfdv-0004zw-Ak for emacs-devel@gnu.org; Tue, 18 Oct 2022 02:00:01 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0F6DD240027 for ; Tue, 18 Oct 2022 07:59:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666072796; bh=dLffbUE9wA617lVyAjD6bEWXkeVkCgT6ahESbV0x8nw=; h=From:To:Cc:Subject:Date:From; b=U+lNwKb8s/qqR9bkbgP8MhZabGVDgeJtKINVWOkqpyVHS9coRnew+XUFEixmPHt3t IzXWLjxbDNKeAiy29pMpPIZYqQBfxZd+CYfGgfx1oiPugOPqiDxG7heezs2fF2UONJ gtN6PGVdJFlR0FYwLg5XfH1+lxvYm3tuEXmrTGi637rKtwggYYUeO9buuJ3mdryMn5 kT/U/3f4oXRivKGIA2jVUpsmBdUoqjHq33jtSvEqxgBDWZSDbtRGmnl8cUMiH+2je8 dJ4ge6sAMMLpL0M2tloQ5T72OKR81I6MeC4wa3lLsxa0YGeRwsqjsIxv9k53N/p2fB 5CjTDlKqiPUQw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ms39Q3cCvz9rxH; Tue, 18 Oct 2022 07:59:53 +0200 (CEST) In-Reply-To: Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:298012 Archived-At: Stefan Monnier writes: > Ihor Radchenko [2022-10-16 08:48:11] wrote: >> Each line is submitted to shell via comint-send-input and, AFAIK, the >> result can be collected using `comint-output-filter-functions'. > > `comint-output-filter-functions` is probably run too late. It's meant > for code to react to changes in the *buffer*, I think (take with > a heavy dose of salt, because I could never really understand the > design). > I suspect that `comint-preoutput-filter-functions` is closer to what you > need/want. I tried to use the suggested hook, but it is also supplied with redundant empty output. For some contents, I am trying to debug #+begin_src bash :session test :results output if true then echo "hello" fi #+end_src #+RESULTS: : > > > hello ^ ^ ^ excessive empty output lines matching the number of extra lines in the script. source blocks with multi-line input executed using 'ob-shell. The main work is done in `org-babel-sh-evaluate' that feeds bash comint buffer line by line with comint-send-input and read the output using comint-output-filter-functions (in org-babel-comint-with-output). -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at