From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2G83Emt4LGDSOwAA0tVLHw (envelope-from ) for ; Wed, 17 Feb 2021 01:59:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4F8MDmt4LGANFQAA1q6Kng (envelope-from ) for ; Wed, 17 Feb 2021 01:59:07 +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 9095917FDE for ; Wed, 17 Feb 2021 02:59:06 +0100 (CET) Received: from localhost ([::1]:36184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCC7M-0001d6-P9 for larch@yhetil.org; Tue, 16 Feb 2021 20:59:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCC71-0001cm-6N for emacs-orgmode@gnu.org; Tue, 16 Feb 2021 20:58:43 -0500 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:34221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCC6z-00016t-IQ for emacs-orgmode@gnu.org; Tue, 16 Feb 2021 20:58:42 -0500 Received: by mail-qt1-x82f.google.com with SMTP id c1so8569634qtc.1 for ; Tue, 16 Feb 2021 17:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+lAiCidrs/1pFQ9R3+db8Iwvh1Tt+HC/HXU45wDoR4Y=; b=GPTwFMw0ow0J8xeDAXQ3AYIi+xSSn5klkHSjEeIJ9KEJpgDxPHyNDSQwBGQNfHmh6V dxeGSELjmjKY6FTL7Z3JaO2BV8yp2R5mUOxf562mUYUVh0Iuy26mW0Gg0DrYSWz5tihO 3hMvXm3sYmPBFTrRvf4bYbeLgVNmH45qbItpp+fVdSmIuvP56+LESsU/edYqoQR1MFkC 6GsVJoLx9blVWfOQBc4enmbUxAIpUNCq5srUw1VdKszT3wlC7qHilnogn0zb1zHXpUrj kAKz2wPlL2j4V7jsm+LVV/woTh4LZbPGMFGGl5NE8Xkl5EM18gGN4c7F7u5EwWsbQuwL cw9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+lAiCidrs/1pFQ9R3+db8Iwvh1Tt+HC/HXU45wDoR4Y=; b=bv7CNrh/gvNcoSJIyl7gEpruXX9X2Ow+J+pvXYoEJjP6DJJOSG9Hsa/L7GFwoYFgf/ L6Ye9Gq92JtMgHH0hhVzXsMzjLuSh5BelB2p8lx3UvVc6phVfPwL3QvmDqMqaJ8B7M6O KksEtSiIshRcCk38Y92abrVZwbXvn7OmnU8fvmDi3NKaef6vSs5s+jhPZal/Qf+8c6qw 127qGu+aHgbjke7XI+A5PLqr4JESdgOzACf6yHvB6m85/6EOTz3crhd28SP5/yaCWIjy fZ81JOPRLX7xwMReSQaPEoAyx061QD7pFJ3blyrEIliKxgZWSYftD/9CK4LhabGZw0hu dlBg== X-Gm-Message-State: AOAM530LiX4wk5zoLeniRwCbO16/B04Fr9rP+ivfc/jw8YIsPg9oh4sV MvXz53mrGh5xEo/tHrQdkCA= X-Google-Smtp-Source: ABdhPJy9B4lQbcHan7ADKINaNaUWT1HWuOoGn4S0SEljDtWHNzhbqPpuEeSjS7wZnbA0s0SkiXPvcg== X-Received: by 2002:ac8:7485:: with SMTP id v5mr21735700qtq.174.1613527119918; Tue, 16 Feb 2021 17:58:39 -0800 (PST) Received: from cibola.cibola (pool-108-45-87-170.washdc.fios.verizon.net. [108.45.87.170]) by smtp.gmail.com with ESMTPSA id o194sm607754qke.101.2021.02.16.17.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 17:58:39 -0800 (PST) From: "Kevin M. Stout" X-Google-Original-From: "Kevin M. Stout" Date: Tue, 16 Feb 2021 20:58:37 -0500 To: Rodrigo Morales Subject: Re: How do you name your code blocks? Message-ID: <20210217015837.GA21805@cibola.cibola> References: <87wnv9b0na.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wnv9b0na.fsf@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=kevin.m.stout@gmail.com; helo=mail-qt1-x82f.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.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=GPTwFMw0; 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-Migadu-Queue-Id: 9095917FDE X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6WbDOGD2J3JV On 2021-02-15 14:18, Rodrigo Morales wrote: > 1. Do you use long names? Usually. Suppose you were doing a bit of genetic programming. You might have a function that computes the next generation from the current one. You could write the following snippet that looks suspiciously like pseudocode: #+HEADER::noweb-ref genetic/functions #+BEGIN_SRC python def next_generation(curr): <> <> <> <> return new #+END_SRC You would then have a block dedicated to each major part of the evolutionary step. > 2. If not, how do you name your code blocks to avoid name conflicts? I have been over the tangling and noweb expansion code quite a bit lately. The chief benefit of using #+NAME on a code block is ability to call it. For example, you might have #+NAME: generate keymap #+BEGIN_SRC elisp :var t=keymap ... #+END_SRC whose sole purpose is to take a table from elsewhere in an Org file and generate the code that sets up a keymap. To use it, you might say #+BEGIN_SRC elisp <> #+END_SRC For every other purpose, :noweb-ref works better. In newer versions of org, it's the sole means of accumulating code under a common name in the WEB/Noweb tradition. In older versions, duplicate #+NAMEs did result in accumulation, but the behavior was undefined. A word on syntax: I find #+BEGIN_SRC language :noweb-ref "block name" ... #+END_SRC less readable than #+HEADER::noweb-ref block name #+BEGIN_SRC language ... #+END_SRC especially when there are further block-specific header args. Either is more cumbersome to type than the #+NAME syntax, but that can be dealt with using something like (add-to-list 'org-structure-template-alist '("ss" "#+HEADER::noweb-ref ?\n#+BEGIN_SRC\n\n#+END_SRC")) Then, to set up a safely-named block,