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 13:15:09 +0200 Message-ID: <87o7u9e62q.fsf@miha-pc> References: <87y1tgqhmc.fsf@localhost> <87v8oidtzl.fsf@miha-pc> <87pmepg0oo.fsf@localhost> <87sfjlegu8.fsf@miha-pc> <87a65tfuso.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="28388"; 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 13:20:39 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 1okkeD-00079y-VL for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 13:20:39 +0200 Original-Received: from localhost ([::1]:45202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okkeC-0002vu-Lv for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 07:20:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okkYx-00082C-D4 for emacs-devel@gnu.org; Tue, 18 Oct 2022 07:15:11 -0400 Original-Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:43716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okkYv-0004s1-8H for emacs-devel@gnu.org; Tue, 18 Oct 2022 07:15:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1666091705; bh=rZn0gjpFr2x1TCAJdO2IRrFIk7nrPBQGCC7Uak2Mj10=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=rgQ7nu36hgmZQYZy6TDo/GfUpUc78qSYs6Smhk3HdnUuglR3Wh2iSNJR7+wTYBRuY kipFSXH2EsZAmxpjr3JOrwPa8RXisLJpsnjIYXky+YhV4zVlrpxk8kqPNJOEFW73P7 U95qwzk3oLYglTqk+wVG34HyuM4/2FL3qqDeI4VSsSKLLRoTZBtWWSPJHt/1n0HAEv e2EqYoFzKqwYGswGjmWxOx8CaziAT520yyLVCrtfvGV3jq4wyc6yEYIZmp3XI5RXSk rwi+ClRLoRK3vzekmUiMctGlg8ZCWZhkZb9k+JQnmxvn9y3cLYWVesj9/pBee2t1Yu le+IsbgGwb+6w== In-Reply-To: <87a65tfuso.fsf@localhost> Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626; 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=2, 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:298029 Archived-At: --=-=-= Content-Type: text/plain Ihor Radchenko writes: > There could be multiple such blocks in the script. And it may not be > bash, but something else (fish, csh, posh, etc). Finding ways to do the > wrapping for all the shell flavours will be maintenance hell. Well we already have something like this in org-babel-sh-eoe-indicator. Having similar variables for ob-fish.el, ob-csh.el and others doesn't really sound like too much trouble for me, you'd need something like (defvar org-babel-sh-boe-indicator "if true; then echo org_babel_sh_boe\n") (defvar org-babel-sh-eoe-indicator "\necho org_babel_sh_eoe; fi") (defvar org-babel-sh-boe-output "org_babel_sh_boe") (defvar org-babel-sh-eoe-output "org_babel_sh_eoe") and similar for other ob-*.el's. Though, thinking about this more, for the case of ob-python.el, where indentation matters, it does indeed sound like trouble. In addition to pre-pending an "if True:", we'd also have to indent the subsequent lines. > So, I'd prefer comint-based solution. > Such solution may also benefit other comint uses beyond this specific > issue with Org. >> Or maybe inject something like 'oldps=$PS2; PS2=""' before the command >> and 'PS2=$oldps' after the command. But whether this works could depend >> on the shell, some shells might have something like $PS3 or $RPS1, for >> example. > But will accept-process-output correctly work with PS2=""? Looking at the code in ob-shell.el, it probably wouldn't just work if you were to prepend your command with PS2="". You'd probably have to move accept-process-output at the end outside of the loop. (Inside the loop, accept-process-output could wait forever, since the process wouldn't print anything, PS2="" after all.) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmNOir0THG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZPzvTEAC+SeroVhqRHEcSiXQka6QJ0KgoKJep Z7Ky+xiHFWh/TXTQB+3TI+WbTQpStnbdTc5ZDgnDUnxO+3UkyniQVZZiYQeorJk+ tLo1M7yTO/VmSDU8wTMTkikngieiW0D/9S+OWpyH+qtjV6DKMhSBtvrnHVirpIkP 7ljy7AiBgn0/KC4BfbNN/tH1WRSB/0pT/qT5BGp6UCN35WzVDM6apxKex1QQTt9f hjxCn89LxUhxcXsQsw89el2JD4jdseeGgRyJPzYLC9bGOGCBD+fqrczUiY2IMM/h 59rZ91Iiq+6ENsmFud1dKai3j5oS2o1uDxUJio6D4urOINB9i5y5HmSBO+wZVZcd f8HT6rb6/2knf9cWRKQsgyHdRMEncUfpgBi5BXQu15Q3HWxzGCoBdXERydCiW7Zc 8Wv447E5PN5LTDmwEFXAUoxGI+L+C9sPDBkGygO1p8Z7e1UskDHJxGb1DRUNqMFE 9iR6Uc2jNY9O6DYcZ3Q44DLsj6hkUnFVPdEywBJhKq5x+bj/sxTpn1AXHK55vSpn BX7cdNG8uf/FmAIX01A9MIRjDmSdJaaiKP02mJcF7OisAliEJFL+auX9/s6U28gJ 8vXaR/DU2KyQUnnqWz2xMmow+YDxJnw/PhnaFzI3MpSE7AVu2i56wA5Cd7lOcB+q d46SePMJdfwSsA== =uZXa -----END PGP SIGNATURE----- --=-=-=--