From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.devel Subject: Re: comint-output-filter-functions and multi-line input Date: Tue, 18 Oct 2022 09:22:39 +0200 Message-ID: <87sfjlegu8.fsf@miha-pc> References: <87y1tgqhmc.fsf@localhost> <87v8oidtzl.fsf@miha-pc> <87pmepg0oo.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24164"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 09:43:24 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 1okhFy-00064W-7W for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 09:43:23 +0200 Original-Received: from localhost ([::1]:32976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okhFu-0004YD-Td for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 03:43:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okgw7-00068v-UZ for emacs-devel@gnu.org; Tue, 18 Oct 2022 03:22:52 -0400 Original-Received: from kamnitnik.top ([209.250.245.214]:38978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okgvx-0000Vx-QP for emacs-devel@gnu.org; Tue, 18 Oct 2022 03:22:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1666077756; bh=/pgh9e6b+DuBt3k3vsCTLUxoGL5w8xw5Q7IOf4IbXbQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=axKsbvkLkE6ve0lN09aYdAQWHQGfMuoQSDkk/LLt7ttecG4PqVpI3Qq5ziVbOnn6Y 7fnhxraHRMJaJwef/G7R7pTYVPdGFVpKvV74yQizm/Oe4SJF8GIJIy34zKzFP1Gy52 eMREj9Z82Hg6b4ccvFIPH8Rtm1bjJk1eQ2UrtaflyScGZO6wwyCSl3+94TVeuDRDM7 jw/HJn07xnpxisgBenFrFsrPMW34tJ2k2vLWE7+yGbJI53WcHzk0aYR7/V6BCHVDJX mksL9NNAHXnU4j16NYdW7qs9F/ze+LIdiHbnAPjpNqM7/RwEcDYR8jMR8HBAw5dNyB 3sIDDFSUXwQ3g== In-Reply-To: <87pmepg0oo.fsf@localhost> Received-SPF: pass client-ip=209.250.245.214; envelope-from=miha@kamnitnik.top; helo=kamnitnik.top X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.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, FROM_SUSPICIOUS_NTLD=0.001, PDS_OTHER_BAD_TLD=1.999, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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:298017 Archived-At: --=-=-= Content-Type: text/plain Ihor Radchenko writes: > miha@kamnitnik.top writes: > >>> Is it possible to distinguish the actual script output, empty lines in >>> the actual script output, and the incomplete prompts? >> >> You could prepend your multiline command with a dummy >> 'echo multiline_starts_here' command have your >> 'comint-output-filter-functions' discard output that arrives before >> "multiline_starts_here". > > For context, I am asking because I am trying to figure out how ob-shell > works in Org mode. My multiline command can be arbitrary bash script > containing multiple single- and multi-line commands. It is hard to > figure out which one is which. I see. Perhaps you could turn your bash script into a single multi-line command by encapsulating it into an 'if true' block. So given if [ $(( 1 + 1 )) = 2 ] then echo "hello" fi echo $(( 3 + 4 )) you could encapsulate it into something like if true; then echo "multiline_starts_here" if [ $(( 1 + 1 )) = 2 ] then echo "hello" fi echo $(( 3 + 4 )) echo "multiline_ends_here" fi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmNOVD8THG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP/qwD/4zIec3anPUzaC/typIisuAMKqw7kcS /P7iypTQ92zG2SYQhn2/H8wunIN2ip+7WcVfxuZR4Hvd3ya7sXWTH/jg3QLQLGyq YzbkaX7M47WkQblHu/nq5V+bD5RQXeDqwAotV27xjT4DCl8Ue7Gbpx7jHy04JBcf s6811SlqigpyVsiTb03XOzvTzKQpnkdHb4tQfuyQYaVCKXdOSoXW7Qe4DDzeHjYB CdGdmrYRND92ZsRf47tPaxRavyKwC236o++zFwhye941YfPZMFf32zZ3ZVzU0NC7 aKx97wRIj41ZHdEyPIlqhJ3yE1wi9PLl4/vljIg+e2tTQCffgeIeDnWEuTjCdZEF P3zWvOofeP7vehEvwKWg06qLC80hxKPrbw8vh9eOB+k9ix/68Oz/7HngTJV6PUUC aXD9ad9xvt8kBdKCa3ctiV3So9MmwYraGMvwDOgVe31EYqawzpLP/v90pNejAsUl eY60NrFDdL6pZSGNIASLZ+cMOKshpxkhgV7bpwOutZhZBq653E5QmGOQYJOUNqRk 4jBFGcBCpAPMvNzxFEzBYXBqHFMBdCU7PbxRznfLcVbW7TZwuAT9DPNDNiQfo9zp SrMBwiGuVZJs5bDDW5gSzO/fr2BZZF1EFPWhii7Cf2e1Wm1nQOA3ZmghO9iZUo/P S/ZZgqcUjbHnng== =r6Sv -----END PGP SIGNATURE----- --=-=-=--