From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aHPcFZDxWV+UNwAA0tVLHw (envelope-from ) for ; Thu, 10 Sep 2020 09:27:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id ICSbEZDxWV9vZQAAB5/wlQ (envelope-from ) for ; Thu, 10 Sep 2020 09:27:44 +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 C41269400D3 for ; Thu, 10 Sep 2020 09:27:43 +0000 (UTC) Received: from localhost ([::1]:49536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGIrm-0002iy-9n for larch@yhetil.org; Thu, 10 Sep 2020 05:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGIlt-0005vh-EZ for emacs-orgmode@gnu.org; Thu, 10 Sep 2020 05:21:37 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:37304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGIlr-00085X-LA; Thu, 10 Sep 2020 05:21:37 -0400 Received: by mail-ed1-x52a.google.com with SMTP id n22so5569792edt.4; Thu, 10 Sep 2020 02:21:34 -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 :cc; bh=HDYySOXXY2/wXC0LIrhDZwcRikGLkthlESe43ZgUM4A=; b=JykAOyYs2zM3ukm8XCyQDhLyb1ACSWu+15z8Im3emW0GBMO8oEwydoTtuJKo1gVZg9 NTKLAAxK89u85G58VCsb1UpYMsLzYhD4wgU4031h8fjUwJsZrTvC8licMkS4IrmIXr+H 1BOrYdq63LveY2zYNl28UuQFoKOM8rKdnN5kSwSJSHER14H634GP+M7B2ZJ2S/Eh+nLt KBEGT/fEEuaagjyY0C+OrnxNCdHIZLqT8+r1zuW6GWHIWvle9FTQZDW8FY4N3RcHWdme Ul2Fe67cIKQIPO9mNj89AfFFHezB3V8VXlmH7WjVPbkvThMoX5FDCbckRmKzSRHmopsK C/Rg== 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:cc; bh=HDYySOXXY2/wXC0LIrhDZwcRikGLkthlESe43ZgUM4A=; b=A2tg8soYXakMzkUVKRiQ+jk9TEUaCQFZGt2nUF6dyqNiHShko2tvm5gsM+ZwXQUpXB fszGCIL/1Js8F0qrnrO9sWuxZ69vSOShspeF5gnoffNPkaIOotE9ByXjVfn8qCV2AyQZ uJUOux+4vizwpnatT2W3Vbqu2URQ91/lrjErQ1r5VzFe0Gd/D55JkTz9+VXfXzD6iKHW HFQtX+J+ZiBuGg1ru0adw7k2V79NkpydxlVCTFjxaGLOn6t3A60xhkrUIpnKU7FJUwMB VyeAnOAIeiUvIBIAhm42gfZYMK+dqf9hL4PSauyxckMOkdCMwYHltkNaMTOwVZ6i6de/ NJFg== X-Gm-Message-State: AOAM530Bo++elD+CP4vdqh+S6Hh3HW3MnM+CPad/FnCZwgv6vOS18uu1 qnim4w+/1YRNKjsdwi/tRLxglcVQxtgcWPaImlo9H1cdIEH64Q== X-Google-Smtp-Source: ABdhPJxVEcqdAzEeIHzbEUhFiNKTXG8vx013soHiLgmNKS0wQPsTm2jdG65EH6APInFTPNj4tUzZvJrx/YGGlCWy+5U= X-Received: by 2002:a50:fe07:: with SMTP id f7mr8601191edt.173.1599729693247; Thu, 10 Sep 2020 02:21:33 -0700 (PDT) MIME-Version: 1.0 References: <87363urysl.fsf@gnu.org> In-Reply-To: <87363urysl.fsf@gnu.org> From: Vladimir Nikishkin Date: Thu, 10 Sep 2020 17:21:21 +0800 Message-ID: Subject: Re: org-babel prepends <> expansions with the prefix of the <>? Can this be turned off? To: Bastien Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=lockywolf@gmail.com; helo=mail-ed1-x52a.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: , Cc: emacs-orgmode 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=JykAOyYs; 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: njJ2vRcLGKu3 Hello, Bastien, Thanks for getting back to me. In ob-core.el, function org-babel-expand-noweb-references, line 2747, there is a 'mapconcat, that is commented as ";; Interpose PREFIX between every line." It prepends the "prefix", that is the content of the block to be expanded from the beginning of the line where a <> reference is encountered to the beginning of the reference itself, that is to the first "<". My point is that this is not the most obvious way to do the expansion. It does work if the "prefix" is a line comment character, similar to C++ "//" However, consider the following example: ``` # -*- mode: org; -*- * test :PROPERTIES: :header-args: :noweb yes :END: #+name: block1 #+begin_src shell printf "test1 \n" printf "test2 \n" printf "test3 \n" #+end_src #+begin_src shell :shebang "#!/bin/chibi-scheme" #<> <> #+end_src ``` Expanding this example gives: ``` #printf "test1 \n" #printf "test2 \n" #printf "test3 \n" # printf "test1 \n" #<> printf "test2 \n" #<> printf "test3 \n" #<> ``` Not a very obvious interpretation! At least I would expect the following instead: ``` #printf "test1 \n" printf "test2 \n" printf "test3 \n" printf "test1 \n" printf "test2 \n" printf "test3 \n" ``` Because at least it wouldn't leave anything resembling a "<>" block in the expansion result. Thanks for looking at this issue. Vlad On Mon, 7 Sep 2020 at 12:33, Bastien wrote: > > Hi Vladimir, > > Vladimir Nikishkin writes: > > > That's not entirely what I want. > > What do you want instead? It's not clear to me from your example. > > Thanks, > > -- > Bastien -- Yours sincerely, Vladimir Nikishkin