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 07:35:51 +0000 Message-ID: <87a65tfuso.fsf@localhost> References: <87y1tgqhmc.fsf@localhost> <87v8oidtzl.fsf@miha-pc> <87pmepg0oo.fsf@localhost> <87sfjlegu8.fsf@miha-pc> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27471"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: miha@kamnitnik.top Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 09:51:30 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 1okhNq-0006tJ-FQ for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 09:51:30 +0200 Original-Received: from localhost ([::1]:40730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okhNp-00016j-12 for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 03:51:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okh8C-0000ng-MF for emacs-devel@gnu.org; Tue, 18 Oct 2022 03:35:28 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:52765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okh83-0002XV-B6 for emacs-devel@gnu.org; Tue, 18 Oct 2022 03:35:19 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1932C24002D for ; Tue, 18 Oct 2022 09:35:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666078509; bh=iWXGF1IDVcerM7G9cZJ2uMUAxqyU5UqBDyGGU4p3fEs=; h=From:To:Cc:Subject:Date:From; b=dfnp1St8lNjHTcX/ywztVHz5UN/bTfYFcCIAWUzuYtwVfdVlUAAXgVqIpfEDKq+nJ AK/oi2PCSfWAv4OczCva/S7j/YUjrj326LFAc2p3DL6zlOHsY2hjHeO2cXs4A6WXpT /9tPaIe2Yj85ve8eSG3tMS6dDYagjtT0l95VXSD5x5FrmjRzACUNleK4PPwHQkSkGc 2KAyPCEaKr9ODVj6Z3uPPDeTs9q7svZ4Mzq/T6eLrPQoQmHlYP/wfJcTv1x1yYzcGn eerpA2dqOLiFQM5T05sDlBMkJy3fmAgvfuDgWrXcCxvYEZVwHvhk7MwuwscNe2JXaA tCd6R9PKVEZmw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ms5HD3hvzz6tnV; Tue, 18 Oct 2022 09:35:03 +0200 (CEST) In-Reply-To: <87sfjlegu8.fsf@miha-pc> 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, 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:298018 Archived-At: writes: >> 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 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. So, I'd prefer comint-based solution. Such solution may also benefit other comint uses beyond this specific issue with Org. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at