From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dominic Martinez Newsgroups: gmane.emacs.help Subject: Re: Using Org-mode for literate Emacs configuration with use-package Date: Sat, 13 Jul 2024 13:56:52 -0400 Message-ID: <35710170-2886-475c-bce1-5885818352bc@dominicm.dev> References: <87le2acq2f.fsf@k-7.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38905"; mail-complaints-to="usenet@ciao.gmane.io" To: =?UTF-8?Q?S=C3=A9bastien_Gendre?= , GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 16 00:11:59 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sTTvL-0009oi-1k for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 16 Jul 2024 00:11:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTTui-0003s9-U3; Mon, 15 Jul 2024 18:11:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSgzb-0000tQ-9W for help-gnu-emacs@gnu.org; Sat, 13 Jul 2024 13:57:07 -0400 Original-Received: from out-173.mta1.migadu.com ([2001:41d0:203:375::ad]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSgzZ-0001bY-5r for help-gnu-emacs@gnu.org; Sat, 13 Jul 2024 13:57:07 -0400 X-Envelope-To: seb@k-7.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dominicm.dev; s=key1; t=1720893418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RytP24c2CWH+3k30NfHYO28D+8HsvSJJ/UTmm3IcC3Y=; b=GrCRH1aC+km8LpUkSaRoCDHIKNn8dSu2UxjxG9T0YYE4XofxmotO6Kqxo9otVIMFzUPap2 VReVsOMPCniP/8bsyQJxDEMsKxFrcYFZRFtaAJyl1uiwFj2YzNB/eNlez9yD8r+gAY4J4e yuJSPvni+53wq/SHkL+vEIDV+3EXRgO9xWPMu//VCnJix3LarDwoUTgWzaMwD6rdchBg7K R1MZjcGRRcLce3S+Its2car+IsPDPmV9Dv/e85VseiuUg2b+XRBH9taZoBaiEDzG1hFVOg Z684rdnpWXkhe0yBIMAqc9TnlDR8WQqrzJ3E72RQTj8Si4D9WM+ssOWPPU8LOw== X-Envelope-To: help-gnu-emacs@gnu.org Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <87le2acq2f.fsf@k-7.ch> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:203:375::ad; envelope-from=dom@dominicm.dev; helo=out-173.mta1.migadu.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 15 Jul 2024 18:11:19 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147235 Archived-At: On 7/9/24 3:39 PM, Sébastien Gendre wrote: > I was thinking of writing Org-mode source block with different parts of > my `(use-package)` call, so I can distribute it into different section of my > Org-mode document. But in this case, I can no-longer evaluate my > `(use-package)` call directly from my Org-mode document. > > Do you have any suggestion ? How do you manage this problem ? Yes, you can do this with noweb. #+begin_src elisp :noweb-ref package-custom (my-var1 "value") (my-var2 "another-val") #+end_src #+begin_src elisp :noweb-ref package-custom (even-more-vars "multiple-blocks") #+end_src #+begin_src elisp :noweb no-export :results none (use-package my-package :custom <>) #+end_src Now use babel to evaluate the use-package source block (C-c C-c) and noweb references will be inserted during evaluation. Some explanation: - The <> syntax inserts anything source blocks with the same :noweb-ref value. - :noweb no-export says to insert noweb blocks on tangle or eval, but not on export (so your exports stay organized) - :results none stops the evaluation output from being inserted into your Org file Also see 16.11 Noweb Reference Syntax in the org manual.