From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mBgRDANxLGCSCAAA0tVLHw (envelope-from ) for ; Wed, 17 Feb 2021 01:27:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CKzBBwNxLGANawAAbx9fmQ (envelope-from ) for ; Wed, 17 Feb 2021 01:27:31 +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 7852217303 for ; Wed, 17 Feb 2021 02:27:30 +0100 (CET) Received: from localhost ([::1]:41496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCBcm-0006C8-EI for larch@yhetil.org; Tue, 16 Feb 2021 20:27:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCBaC-0004s1-HK for emacs-orgmode@gnu.org; Tue, 16 Feb 2021 20:24:48 -0500 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:36677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCBaA-00066Y-ML for emacs-orgmode@gnu.org; Tue, 16 Feb 2021 20:24:48 -0500 Received: by mail-qk1-x735.google.com with SMTP id v206so11436884qkb.3 for ; Tue, 16 Feb 2021 17:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=yKhfCiEVmO5l78w7UVluo+g2rl6f5kOt0UxVuLem3qc=; b=dIpkxcLGJiTqHxBPlQ5abZgpNXPSvbHzAjR3cNR0C9qJZQCfjp+0De2pxC//uVCZsj RcShTK2beLhnU+5w6N+7SCFmr56w5jI+n11D17VnKHlNvhNJkQJtqqYwcVTbBgyI+Juh 8/wppkfLhbH6NgLxx8wmEv6ib9fYZxUGaFkqux2GoADM5B0lWJszeRQrCijC972AWYrT HOutVpd2/ViUwgwlvO73kxFRHVIVFYfC6WPE3RlL0Z4fDVqzfFRF4q4xSZlwNK5NZ0Kh JY65pMU18mTrVtia1MsrXUTpEpmaPIoNhmPV/KYCddreM+vVBuf/eYGZ08yU/JX4jCQ0 GpQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=yKhfCiEVmO5l78w7UVluo+g2rl6f5kOt0UxVuLem3qc=; b=ZROUPhy6cmaQMyZ9x4OVDDmhbU7GCR90LMeRFwveCAgpP1ENTipR2hiAVu8TmHyRZX saD1aVnLc5io58hk9YuGOVxCyhDGFmrQEwEH/OtplsQ+KJj4uEAQkXs0JEMQAS5PJfsn 18SqeHS7cVbDES9tcfCKEC7eIuFYyd4MUZzvYSVK0xdIOkCSJKtnkBDU5aAYguwkBUZ4 ansrsNouL2QGkLQuH4q3Ec4KRhRL/xwx02dpMmu1AMiDqxOjqiGHzque3W+z6bLadizm 6JxKNvf1PggwiN1l+CLP4srsDBRCvmtz0lNU/YaOO6i3Vf7HqKnIZAnPBbBFkB0KBNlq hBzA== X-Gm-Message-State: AOAM531rmABW2gjyqg986zAlFkyxF1wO5pzZjN94bTYqpL585ujUkWyk tRuJXx8K9+iHbk/3tYb0Ljs= X-Google-Smtp-Source: ABdhPJwOpWZDuXHmIluognKurDbjDOVoBsGy1B4slX/hRvpkg5QxXUwNr3WrpeFGf0WP60+iix0FeA== X-Received: by 2002:a05:620a:15ea:: with SMTP id p10mr16660726qkm.192.1613525085368; Tue, 16 Feb 2021 17:24:45 -0800 (PST) Received: from localhost ([190.239.232.181]) by smtp.gmail.com with ESMTPSA id v7sm557901qkc.105.2021.02.16.17.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 17:24:44 -0800 (PST) References: <87wnv9b0na.fsf@gmail.com> <1417212.1613451192@apollo2.minshall.org> User-agent: mu4e 1.4.14; emacs 27.1 From: Rodrigo Morales To: Greg Minshall Subject: Re: How do you name your code blocks? In-reply-to: <1417212.1613451192@apollo2.minshall.org> Message-ID: <87wnv7lcam.fsf@gmail.com> Date: Tue, 16 Feb 2021 20:21:05 -0500 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-qk1-x735.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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=dIpkxcLG; 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: 7852217303 X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: XP8xvqsahs5z Greg Minshall writes: > i guess part of the answer depends on why you are naming your code > blocks. I was asking because in my notes in Org Mode, I am used to create subheadings for each question I have. Here's an example: Let's say that in my notes on Python, I have the following content #+begin_src org ,* DONE How to get the number of lines in a file? - State "DONE" from [2021-02-16 Tue 20:02] ,#+NAME: create-file ,#+begin_src dash :results silent cat << EOF > main.txt first second third EOF ,#+end_src ,#+begin_src python print(len(open('main.txt').readlines()))o3 ,#+end_src ,#+RESULTS: ,#+begin_example 3 ,#+end_example ,* DONE How to print most repeated word in a file? - State "DONE" from [2021-02-16 Tue 20:02] ,#+NAME: create-file ,#+begin_src dash :results silent cat << EOF > main.txt fizz fizz fizz buzz buzz buzz buzz foo bar bar EOF ,#+end_src ,#+begin_src python import re from collections import Counter with open('main.txt') as f: passage = f.read() words = re.findall(r'\w+', passage) word_counts = Counter(words) print(word_counts.most_common(1)) ,#+end_src ,#+RESULTS: ,#+begin_example [('buzz', 4)] ,#+end_example #+end_src As you can see above, there are two code blocks which creates two text files so that a Python script can then process it. Both of them create a text file, that's why I have used =create-file= as the name of those code block. I could have used very long names but I don't find comfortable myself doing that since it adds extra effort to think in a name for such simple code blocks (see below an example of the approach of using long names). #+begin_src org ,* DONE How to get the number of lines in a file? ,#+NAME: create-file-for-counting-lines ,#+begin_src dash :results silent cat << EOF > main.txt first second third EOF ,#+end_src ,* DONE How to print most repeated word in a file? ,#+NAME: create-file-for-finding-most-repeated-word ,#+begin_src dash :results silent cat << EOF > main.txt fizz fizz fizz buzz buzz buzz buzz foo bar bar EOF ,#+end_src #+end_src -- Rodrigo Morales. IRC: rdrg109 (freenode)