From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GKtWE2XNWV+DBAAA0tVLHw (envelope-from ) for ; Thu, 10 Sep 2020 06:53:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aHEwD2XNWV+TKAAA1q6Kng (envelope-from ) for ; Thu, 10 Sep 2020 06:53:25 +0000 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 E76A69400C7 for ; Thu, 10 Sep 2020 06:53:24 +0000 (UTC) Received: from localhost ([::1]:40472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGGSR-0001ef-TW for larch@yhetil.org; Thu, 10 Sep 2020 02:53:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGGS7-0001eS-3j for emacs-orgmode@gnu.org; Thu, 10 Sep 2020 02:53:03 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:42962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGGS5-0000SY-FZ; Thu, 10 Sep 2020 02:53:02 -0400 Received: by mail-ej1-x62a.google.com with SMTP id q13so7073600ejo.9; Wed, 09 Sep 2020 23:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=303d9l9DTPKYFlJ2pvTeEdXhVcAQHLq11h/qNszMTEI=; b=gcAJAdBdhnGtu5XL1Y6Cdt6Ml5mkWjXHmZwMw5Pvo2OapUp5URO0Leir+m6nq6JeOk XqR2kf1IHdECPBhKw+Jfcey2nmVxTAJ5RhuWOHzGjgn72Wd1KOp9ZnEgZWg2WIfJf2jc Krwbx4a78jX5xt/LJClfQA/0z/4zVvp9MbVq3zIlgh/E1ILf+Y5GGlEfJ0nmFdVQtXnE CSX2aR9bflUd6OIuoPVh/Fc59Hkfs5Kz82DOMGPEUoNaBe5rigtLSuyF0uZiNxjzadnk 1TUE4SAMsgF19Hy4PxFxMm3uSRwJH4AMq6ZqI6sclu3bA4FRV4wHGC/q7RewBiBxrH5F 1P4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=303d9l9DTPKYFlJ2pvTeEdXhVcAQHLq11h/qNszMTEI=; b=Dx7crKAc9+YMnQzj0U1X/x2G2I2+lxCDrOBYozsts1bCFeqDSoh5PMi+e3XgCqGKm9 yrkM9x7e3HkgkdinGR1sk6qzX9rPKXed/Eu8PxoW2SdGQ53sPXJE1/u3LMSDcfha3YSb ermn0RmdRuYLG4BveOJPf/nB/E3UQqaSCcA8r76obUB11Rc2v4LBQe8yakoPA7KdoEug WM7J1bNc6+WJCiHM84CaKuN9GxnfL/bf/NhedAzigKCoyVavcBUYtA/i9+Er1CJ+bshL rMu3dL9GJlchIDymIyPlJSjYnoYptytd+j8yz+fNzKKEJeMXuyXwlyicA78YI22C9WYz 5N5A== X-Gm-Message-State: AOAM5316RkRsgQ8buf97Ul4DszeMb6H7XVODkQaZI55UQ5lbGbs0c0Y1 F5uD7JjyuZs9updwRGyCqKfaYTVzWrxKdwr0+yWcuSwrWKlqyg== X-Google-Smtp-Source: ABdhPJzE0+Z9IAL++MR5EPTb2lu0srXPIl+FMG0Wbw75ioiCkbO5xzzMw40QHqZUdopMT0FgbDbGnC/SlrM/mOykwjE= X-Received: by 2002:a17:906:c55:: with SMTP id t21mr7655934ejf.276.1599720778557; Wed, 09 Sep 2020 23:52:58 -0700 (PDT) MIME-Version: 1.0 References: <87y2loakcw.fsf@gnu.org> <87d030ae7g.fsf@bzg.fr> In-Reply-To: <87d030ae7g.fsf@bzg.fr> From: Vladimir Nikishkin Date: Thu, 10 Sep 2020 14:52:47 +0800 Message-ID: Subject: Re: Shouldn't ob-shell's org-babel-expand-src-block prepend the :shebang value? To: Bastien , emacs-orgmode Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=lockywolf@gmail.com; helo=mail-ej1-x62a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gcAJAdBd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.71 X-TUID: 7pX/Jeh1doJW So, my point is the following. A shebang is an almost universally accepted way to specify which interpreter should be used for code evaluation. In the ob-core.el, at line 787, the function called org-babel-expand-src-block makes a buffer out of the noweb-expanded code. (I am working with org 20200907) The sexp is looking like this: (org-edit-src-code expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")) I suggest replacing this sexp with (org-edit-src-code (seq-concatenate 'string (or (alist-get :shebang params) "") "\n" expanded) (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")) This way the expanded buffer would respect the shebang, and the resulting buffer would be saveable as a runnable file. I suspect that the second branch of the (if) should be left as it is, because non-interactive usage probably means that the code will be used later as a part of something, and therefore does not need a shebang. Vlad On Sat, 5 Sep 2020 at 15:13, Bastien wrote: > > Vladimir Nikishkin writes: > > > I'll try to do one this week, but I can't submit a patch officially > > because of my employer being staunchly against signing the copyright > > disclaimer. > > :/ > > So please just give directions on what to modify and how, and that'd > be enough for someone (probably me) to get started. > > Thanks! > > -- > Bastien -- Yours sincerely, Vladimir Nikishkin