From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QI8zJehXIGFSewEAgWs5BA (envelope-from ) for ; Sat, 21 Aug 2021 03:33:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WITkIOhXIGF1YAAAB5/wlQ (envelope-from ) for ; Sat, 21 Aug 2021 01:33:28 +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 2A5F422E60 for ; Sat, 21 Aug 2021 03:33:27 +0200 (CEST) Received: from localhost ([::1]:44772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHFsz-0004Nq-68 for larch@yhetil.org; Fri, 20 Aug 2021 21:33:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHFsQ-0004Nh-Jv for emacs-orgmode@gnu.org; Fri, 20 Aug 2021 21:32:50 -0400 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:35675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHFsP-0007xJ-6h for emacs-orgmode@gnu.org; Fri, 20 Aug 2021 21:32:50 -0400 Received: by mail-qv1-xf2d.google.com with SMTP id g11so6547718qvd.2 for ; Fri, 20 Aug 2021 18:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=EcJmayn2C/dsVNHi6I0DSBiIeU6B4fdT6Kz4RoI4m7I=; b=sROBdzj7o5uy593iKFmkA5Z8GJXHTaByG4BfSLg7QbS8h7S1lfJITSbtj2wu9XKgMd 4IxivwrnMM091+Zy7X+aV0aXpi9gl+6lDjkOn0XpUGLyn9+X1/vy9PZwepw+wutFMaDh Acq6s9qaPCA2uxe9Ys2Ez1gG6JOZAdGuxXeh2ltXylyHlLLjP9xAz4GZUlr5C6heGYw+ BiJT0iy8sGdIlaouCGxdnrB199fjw73Lw7SYGsx1PnjFafey9uHbttmsAsl6ew/oP2Mw CE9frIlenpuVm4S2h4pwztPmjt2/Kf2ucedRpjdLMp1b3x7jfu+9j737L2SpmnNOQe8m W6qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=EcJmayn2C/dsVNHi6I0DSBiIeU6B4fdT6Kz4RoI4m7I=; b=q749w233HKY3Ny721Ll/IC/cjFhMvM6KytUNxrhwXfwefUobO7Kb2SOyRZu8If7Isn BQEBOF+JBR8rpoIf1zn3Q1s9gcto0MamQB+71SYSVjRR3REcUonf2Ais2GLmumvWTGAA e/3w3GJAhCMaiCQMaBS0XSUxt+n3gfItDcQJAw5QBAEWzOKlUWc8ojRfRxTmmf37ouyp ZLKtNYb01um+X90/miuOizd5UqpqucdorAHSDLhF1GgIVRL3/7/ClWnaG+YoPLuYpuVO yXt80aayUPXAk7MBeP2tXnWbuuLRXWaFoZA4UbhnanBLrXfv057kyz1rE8O0ElynAZP6 SC4g== X-Gm-Message-State: AOAM531unKInaN+yvRihSvP8oJm4cR8txsMQGDQ/3trFHHiUn7fVt13f Ny2w4aJlOVVXwxp2QJPVpmIJURVvE3GAHw== X-Google-Smtp-Source: ABdhPJy0GX1PdEGOsJT9KoSKGqDAotVeMa97ldE5m03AZh8ja03ZSUuhpIJvJNUCsNXn/+s18pZk+Q== X-Received: by 2002:a05:6214:54b:: with SMTP id ci11mr5230833qvb.24.1629509565562; Fri, 20 Aug 2021 18:32:45 -0700 (PDT) Received: from r1 ([190.239.232.245]) by smtp.gmail.com with ESMTPSA id d7sm3388381qth.70.2021.08.20.18.32.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Aug 2021 18:32:45 -0700 (PDT) From: Rodrigo Morales To: emacs-orgmode@gnu.org Subject: Functions for inserting name of code blocks Date: Fri, 20 Aug 2021 20:31:36 -0500 Message-ID: <8735r38txj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-qv1-xf2d.google.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 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, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629509607; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EcJmayn2C/dsVNHi6I0DSBiIeU6B4fdT6Kz4RoI4m7I=; b=c6/jFWJlwpPLh8qg/vcTBKIyhCqRTyYmRSDhoCrPaeFu4hNwXqztUuXSqHXrqGvYUnWisp tuaYMJJej0jOPLxOHHEYBotoIZv5BjUfO5DCkA9vrHqWv0pu0EH6U1bZMefXWs020PJ3Rx b9GFErejkk99DebFLnISNjo+wQQv72XWZ5vulsQGAiMRFnCraqqrlH6CiWKhY12/1cq1uT F8uC4QTxgOXQmz4Eh2awr4WtoTPS9sC4dZnDGyjqaIyNqDSLPt7APqhmK74MvLKdWw3wLk ddyHvw6vVckyROoNBA8XRfuani+nVfUsejuvvE8HZLrvSz6BVaMCcRSsbQK5pA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629509607; a=rsa-sha256; cv=none; b=plSRXZ9v4+rQsj1G3Z+9YSG7p8YnfMwgo8TJw/wwCP3pMqj7UZdRhOl1ZLa4VO6lXwgO1T +CXt5l7cVlaWCyWIgGgOkx3sv0nyMh89TxTZFUKGMFdT4rR8hHKlslofDZzXEgY3V02mx3 EyRXEo4JQBf1W61b+u4yfIWED/8iNeeq/jTdxf+a+UQ6QHFnMUa2qmRbTg3i72oMuDlIuo bo7QdhLB3jtJv8RS9E8jbezACdsq0UhWI13Cs58RyAvr+RFjgdfm7dO4zcJ6LoB6GYnQmt JrP42rzqLmfomE7y7UJ0etZVagdK1+IR/QgFYKjsPf5xd1XP5l46z82vsu0+6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=sROBdzj7; 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-Spam-Score: -1.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=sROBdzj7; 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: 2A5F422E60 X-Spam-Score: -1.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: oVo111Th8O7X This thread asks for feedback on functions that I've created. These 2 functions have to do with inserting, at point, the name of a code block which exists in the current buffer or in the library of babel. You can find the functions below. #+begin_src elisp (defun my/org-babel-insert-name-src-block-current-buffer () "Prompts for the name of a code block in the current buffer and insert it at point." (interactive) (let* ((names (org-babel-src-block-names)) (selected-name (completing-read "Names: " names nil t))) (insert selected-name))) #+end_src #+begin_src elisp (define-key org-mode-map (kbd "C-c M-n b") 'my/org-babel-insert-name-src-block-current-buffer) #+end_src #+begin_src elisp (defun my/org-babel-insert-name-src-block-lob () "Prompts for the name of a code block in `org-babel-library-of-babel' and insert it at point." (interactive) (unless org-babel-library-of-babel (error "The variable \"org-babel-library-of-babel\" is empty.")) (let* ((names (mapcar 'car org-babel-library-of-babel)) (selected-name (completing-read "Names: " names nil t))) (insert selected-name))) #+end_src #+begin_src elisp (define-key org-mode-map (kbd "C-c M-n l") 'my/org-babel-insert-name-src-block-lob) #+end_src