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 0Ld2H5/Wwl/AYwAA0tVLHw (envelope-from ) for ; Sat, 28 Nov 2020 23:00:47 +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 OLBHG5/Wwl8LSQAA1q6Kng (envelope-from ) for ; Sat, 28 Nov 2020 23:00:47 +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 08551940630 for ; Sat, 28 Nov 2020 23:00:46 +0000 (UTC) Received: from localhost ([::1]:52012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kj9Cs-0001Gv-MQ for larch@yhetil.org; Sat, 28 Nov 2020 18:00:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj9CE-0001Gg-Sx for emacs-orgmode@gnu.org; Sat, 28 Nov 2020 18:00:02 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:42867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kj9CD-00075z-6U for emacs-orgmode@gnu.org; Sat, 28 Nov 2020 18:00:02 -0500 Received: by mail-wr1-x431.google.com with SMTP id l1so9774739wrb.9 for ; Sat, 28 Nov 2020 15:00:00 -0800 (PST) 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:content-transfer-encoding; bh=7LN/JaLIOgxOISDu6ea2CjbMqBOcSvd3OU+bmCa6HwM=; b=h6lvZHOcOEJwrEg/otj4MfbtpnuH4Y3t2xJtUZm6BmNYbrEFgKRs5QddSMXrNr3abJ /+7IbPmuyX+iQOfSRbFz7j0XPq0v7DLtDsTG8ZcKP4mNzciTVcEmP/x8kwuF2f0nSLqA RmKNwzUVmxaIZjI8iWwTAVKFibqXBalU2w79HhrJUkUevVpgpszDwBHeu2qPwBn5kHUa DjxwxmetiVTQLUzORRSIomtg2cFYCo5mijdeV/TpgOX3rXycPBCwjFPe8ZepmV94PWkt PWyfK+cGxp9d2VAIa5BwiVGN5AZyNzucn5yYoo4vDjpu2yhQDjxSIfCnvdB/UMYkCbun X4CA== 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:content-transfer-encoding; bh=7LN/JaLIOgxOISDu6ea2CjbMqBOcSvd3OU+bmCa6HwM=; b=ZzHd145Nv+zRTa+af+iWfb6nmtoiIyvgP2nMyvCcm8HkbmWgZfnTs4doHxW68x5Gpv 1TJqQl2fcT/9hFRULvF51esAv7kDQPhMx9nkmbB3UYmUwGGO7XXEJQIJ+t+/p57GxiHl NeWx7smXThmTv0V+WO7Rr9jf3Ye7vgeBCBlG+PWNVzGCTa3Lgaf6QSkDuI6cl8WXHLQs BTnQX7gOM0Idj56Vj4u4iVOjvfQ8TIS0YoYykuwN/uULf0+9GBHpqWoShpq6JjD4w+Rv T4RcntBhiyag326+D6u7y7/eAIUjfZNycgB18SxFGpeHG7FgNKnw4sUU5VuarDGhZDNI foAQ== X-Gm-Message-State: AOAM533CodDOCpuP7wFEsb8eGm4ePqcFCstGwpCl+H8b+dAvlTZUC25s aDWPlmy+T6ewGI2yyqqtFPPDtkkOjDrHTVObBRg= X-Google-Smtp-Source: ABdhPJyqCYRKoumERLKoj99PznPa9tPSgSYMm9XLDAWMxs9pxytPDOaDaqHOJrxUsc0U8vEmtfkuu+OXnzvUfJNwwEI= X-Received: by 2002:adf:916e:: with SMTP id j101mr20318176wrj.55.1606604399224; Sat, 28 Nov 2020 14:59:59 -0800 (PST) MIME-Version: 1.0 References: <2PnBr0V8kH99j60xzpYf0HgMQZZtQ_FTnrNNhbHxzgTnxuJqv3y_tSGDNcv4Pqzvlfy4RLgmUbw83UIRiJXTgV9-_fDlwJOaCIon3zJo_-E=@protonmail.com> In-Reply-To: <2PnBr0V8kH99j60xzpYf0HgMQZZtQ_FTnrNNhbHxzgTnxuJqv3y_tSGDNcv4Pqzvlfy4RLgmUbw83UIRiJXTgV9-_fDlwJOaCIon3zJo_-E=@protonmail.com> From: Tom Gillespie Date: Sat, 28 Nov 2020 17:59:47 -0500 Message-ID: Subject: Re: Multiple named code blocks To: mooss Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=tgbugs@gmail.com; helo=mail-wr1-x431.google.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, 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@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.97 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=h6lvZHOc; 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-TUID: RVwriI0Ud1Tx Hi F=C3=A9lix, I think that it is probably not a good idea to implicitly concatenate blocks that share the same name. There are a number of major downsides. One reason is that all the other parts of org-mode assume that there is only a single block with that name, or rather have undefined behavior if there is more than one, so all the other reference resolving infrastructure will not work as expected and it will be hard to navigate to additional blocks. The concatenation behavior you describe does work if you specify the same file for tangling, however that uses completely different code. Further, if we were to define behavior for what should happen if there are multiple blocks or sections with the same name it would probably either be to signal an error (if you are in the more immutable camp), that the first named block is the "canonical" block (current implementation), or that the last defined block is the "canonical" block (if you want org to be more like a programming language). The current implementation follows the first named block, but the reason why the manual states that it is undefined is because even that behavior should not be relied upon (thus why an error is probably the most friendly thing to do). Consider also that if you have different blocks by the same name in different sections and you reorder the sections the order in which they are nowebbed in will change. Given that that behavior can be actively dangerous (imagine a block with cd some-folder followed by a block rm contents/ -r getting reordered), there are major downsides to trying to guess how to concatenate multiple blocks and trying to specify restrictions on where and how using the same name is allowed or can be safely used is not something that anyone would want to try to do. Best! Tom