From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CJ8AK/r4/mEbGQEAgWs5BA (envelope-from ) for ; Sat, 05 Feb 2022 23:23:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sGLZJ/r4/mEDGgAAauVa8A (envelope-from ) for ; Sat, 05 Feb 2022 23:23:54 +0100 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 4E6E84004B for ; Sat, 5 Feb 2022 23:23:54 +0100 (CET) Received: from localhost ([::1]:41128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGTTF-0008FB-BH for larch@yhetil.org; Sat, 05 Feb 2022 17:23:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGTS2-0008Em-SU for emacs-orgmode@gnu.org; Sat, 05 Feb 2022 17:22:38 -0500 Received: from sender4-op-o13.zoho.com ([136.143.188.13]:17364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGTS0-00028i-70 for emacs-orgmode@gnu.org; Sat, 05 Feb 2022 17:22:38 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1644099751; cv=none; d=zohomail.com; s=zohoarc; b=kT3UXBIir3BG3lcrRr5P5eu4BLaweF+X0lCu5yYS5r8aPv/OYN9mCeJrvYm/5mCJatXnwDBDVRTqRqqcNNtmL+S5tIYrXzVqAl1XPOk3JVPHLVKEDMzecNpCtJSrU4dAJ+bgMKSvGxwoso1x/ZIV8ljQWSCZbNlygPkKUGdwM0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644099751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=iqVPpohOycy7OafL6GWl2ZsTCrW/q7fdyYeJ4/jqPNM=; b=CEDZvqmrzYP7UGTXfOZ/ROl2Ny5/SPhfI67yxFIrS7wf0admVnAiksHtDO55cYneGzNRSvwxA8EjuUFf7s19Imi58waqsPymv2d+2WBsJ5EeMtui6v2OEz62K+xl26nREvLhxJ1yFJvbmxPc3Pb99cbDzDRbLTmgFP9VcO25bXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=excalamus.com; spf=pass smtp.mailfrom=matt@excalamus.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1644099751; s=zmail; d=excalamus.com; i=matt@excalamus.com; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=iqVPpohOycy7OafL6GWl2ZsTCrW/q7fdyYeJ4/jqPNM=; b=CuuM4ZylX9UKfynF2T8mXRXdr7Khh/9I6DjdsSCPm2LJ9d6M4mrBlimE+Yyb8Aia 4kBHRtgXxwfC0ryl3JnIr3pgeySw3ahuaP/Lpdpq53m3HVLaMMYDQOSkIyeCB1iXBHr WJdaoTIpydxg5hf9LH2IYmLpHVONBASYxmWFqyYo= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1644099749631714.9013505727222; Sat, 5 Feb 2022 14:22:29 -0800 (PST) Date: Sat, 05 Feb 2022 17:22:29 -0500 From: Matt To: "H. Dieter Wilhelm" Message-ID: <17ecbfb46e9.e16df906236239.6523271905911672361@excalamus.com> In-Reply-To: References: <8635kytmkx.fsf@duenenhof-wilhelm.de> <57a07903-cb7a-67ab-7a93-c6d03654c17e@ctpowe.net> Subject: Re: Shell SRC blocks under Windows MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Received-SPF: pass client-ip=136.143.188.13; envelope-from=matt@excalamus.com; helo=sender4-op-o13.zoho.com 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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: Michael Powe , emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644099834; 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=iqVPpohOycy7OafL6GWl2ZsTCrW/q7fdyYeJ4/jqPNM=; b=bk4lDLqf/iB7o2AFri24z7pTGzkREBcoPs/SjB8AcQ/2pp7r07HJVToHo6DQ3gUGWCDNOu j6NoGXVZnAnaRe+FQclmlzZQbY5gSC7OYdFOBep7LDz2YLMhxSNJLpa1wetY8ktRSc6Nk1 5wt6xtTHJOvUHeg25Hv5NxdXuZgZ2GRVA5JAjey2MZtn99TSaeJR1v5mdLZgMJM1+Mh9ob nNcnnna5YeiG/0DrsVBpqW/4JoqtFJVDoCa0jCGN4o6YNlTRDGu+H6Y1uYnkyIrL4Ha8OE r3Yqy1oUS8dPTmaFKg+SBUObC1bGKGXPikV3CqvQgaiLKmolSyL2cGa0doCXDQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1644099834; a=rsa-sha256; cv=fail; b=JQBc9NlTbkzglkg7aqt+tZw7KRcAjkvqz0cFquk+0hofZefTm7erzCbDQDT4L48QWWohR3 001kQa3hyhcdshp237OQs0qwEl+WV7r4TftKhcQwJ3185UZCaxD/8ssS9n0sH3ht3SpqKZ D4+onRv/xCU8Gu+fgJDLZ9rtkiDCre6aE2iWYuZXl7TcG4HflY+j0NaKbNj+PRV/piFGqk 4GJPhC0fCLr26RUqEhFD9w/T7zJHlrfuc84pDgfk8KQtOIPrhw6wINd3aiWqPGfC3Yk0LL 9udhPrsRdkGDf4vLreW2votGTPwyYSUpto/GVMktJ1E8Ky1s+1Rmvsg3rtxMgQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=excalamus.com header.s=zmail header.b=CuuM4Zyl; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; 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" X-Migadu-Spam-Score: -1.12 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=excalamus.com header.s=zmail header.b=CuuM4Zyl; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; 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" X-Migadu-Queue-Id: 4E6E84004B X-Spam-Score: -1.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2X+jA9ePyysO ---- On Sat, 05 Feb 2022 10:48:02 -0500 H. Dieter Wilhelm wrote ---- > >> Is is it possible to extend org-mode's src blocks with > >> org-babel-shell-names to use either MSYS2 or MinGW shells (instead of > >> cmd.exe)? Unfortunately ob-shell.el doesn't guide me further and I > >> can't find examples or the respective lisp files on how to define the > >> execution functions. >=20 > Yes, you are right, when using=20 >=20 > > #+begin_src sh >=20 > It seems that I'm also running some bash shell! : =20 Yes, it's likely possible to run those shells. Whether or not it will be st= raight forward or not depends. It's not clear to me what you're trying to d= o. First off, you're looking in the right place. Unfortunately, ob-shell.el c= an be a little tricky to read. All the shells are initialized through the = =3Dorg-babel-shell-initialize=3D function. This creates a "org-babel-execut= e:" for each of the shells given in the =3Dorg-babel-shell-names=3D v= ariable (where is given by #+begin_src ) . The default shells = are: ("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh"). A= ll execute calls make their way through the God function =3Dorg-babel-sh-e= valuate=3D (note: the "sh" in the function name appears to be cruft from wh= en the ob-shell.el module was called "ob-sh.el"; it is not tied specificall= y to the sh shell). Technically, which shell is used to evaluate the block= depends on the source block parameters used. There are several possible pa= ths. Unless something weird is being done, however, the block should be ev= aluated by . It looks like you're using a simple one-off shell, not = a session or a shebang, so I'll speak to that. For #+begin_src sh, the block will we evaluated by whatever "sh" correspon= ds to in the environment Emacs is running in. Under the hood, a call is ma= de to the =3Dshell=3D command and the =3Dshell-file-name=3D variable gets s= et to whatever the block specifies. The an binding happens in =3Dorg= -babel-shell-initialize=3D. So, open a command line environment that would= be used to start Emacs and see what "sh" corresponds to: which sh That's the shell used by #+begin_src sh. Similarly, whatever "which bash"= shows is what #+begin_src bash uses. This is why it would be surprising that cmd.exe would be used. =20 I know that was a lot. Depending, it may be as simple as updating the =3Do= rg-babel-shell-names=3D and rerunning =3Dorg-babel-shell-initialize=3D. Ch= eck the doc strings on those. Otherwise, I hope this helps ob-shell.el gui= de you better. > But I'm not sure if I'm halfway there with "sh"? I need to run the > following MSYS2 command AND switch between two arguments (for building > Emacs). >=20 > \MSYS2\msys2_shell.cmd -mingw64 >=20 > and >=20 > \MSYS2\msys2_shell.cmd -msys. >=20 > How could I achieve this within a src block? I'm not sure I follow you here. Can you please describe what you're tryin= g to do and the system you're using (e.g. Windows, GNU/Linux, Haiku) as wel= l the shell used to run the Emacs instance you're doing this in?