From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id QHWwA9vsh2fBGgAAe85BDQ:P1 (envelope-from ) for ; Wed, 15 Jan 2025 17:14:03 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id QHWwA9vsh2fBGgAAe85BDQ (envelope-from ) for ; Wed, 15 Jan 2025 18:14:03 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=pEVrUJKm; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736961242; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=MaQqQbpoEYO4I+SP3LvpVrk0KMudZ6xKPWihEaSkQtY=; b=P2JiZPTWwBawxTIib/a1pIpwTLRHmX75hPAu1HMR+YmMfZJMljxQSY6MfP+1Fjc/sV+sVy 0Z9AbYuNHgkuYM/rdN3QHFZCF5IZeBWNmPRxulBUSWJmx5Sjng6psa8R0BaUMS9yGipScm 9mKbb4vzJTO5NHrA5/Fem3ku+p4oH4FHoAaUqr8veV1SIDdozqrAy3SO76z0s4zGqTcXFC FD39ldLTnXkkUl8z5Itg0o9v50Ud2oo7PWsekNhB/RBsmu7SYSCbGTNy7v3DMfZhAqHMpG u6eXHYQ2jhHyYOIfDiUAbpXW7gLpgNudj7T7Iu09DdSPwtTFCepwIkpNYtHVww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=pEVrUJKm; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736961242; a=rsa-sha256; cv=none; b=h32Nlr6oS7HUnZ8AyRT4VQjnoYPsxdHr4Gl+lUiyE45DSjvt6FHXe68GEwSl1raamcospW mx9rwjV70t9+L/RZdWfQsTNbqNF3oHR5SswaszzrcaSPtBTmeIkDhBPU3OMoSiAwwD8BQ8 mNCYEAT9whaui83VkRUVKc8FVX0N+w7VXr06XJgHaxAnFvFJbLWh8jkJ8KU9VEABAhYniA YTWm7MDYdDloClVXXdC0rlUJJ/QHZwxOzUw4cizWUobDDYJU6rsFKSzRIxeKu2leXdJ8IH goMa/qV2piSkVZLZb/IiGTF2LKbW8WLf/KygWRkf84hTNDnyiqvI/RMuZFmRmQ== 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 EFBFA54AF6 for ; Wed, 15 Jan 2025 18:14:01 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY6x9-0007BA-S6; Wed, 15 Jan 2025 12:13:16 -0500 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 1tY6x3-0006jZ-PR for emacs-orgmode@gnu.org; Wed, 15 Jan 2025 12:13:11 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tY6x1-0006q9-2r for emacs-orgmode@gnu.org; Wed, 15 Jan 2025 12:13:09 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 09148240027 for ; Wed, 15 Jan 2025 18:13:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736961185; bh=6WpA30f2Q8BcMDstXuAdSflo83nBQlwDhv1VIMFNJ6g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=pEVrUJKmtGgcOa8ssPtT4v6xEBouk5Nbw4iX8tkSbrxM4d6/KM6LmK3MErlkW1vGn SNDs3NsCPbZv0pQYGXLoI50Y6ZPYA1fC+LErBh5THwxEcLpIH0FTR22+IUkltPhH59 KKezyMbgMe0hwsf8DAT0rzK+GDMnXZqkRp1/Awrl/+EyVog5BTnL1Q7E6x51U5N2CR fdAplstE65usshcYGZJQ8WgZla5U84j1+FVxfbSeUYZRnRJ2yNayBw20AtJ2C1+hm+ tjtlcN3gi1csHUaIZ3jQAJmZoIt+A6jfOHw6u/k06JGw94UT7/W9HE4+LM0DrJp+pa avrAxhxirxz3g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YYCHh3BPFz6txT; Wed, 15 Jan 2025 18:13:04 +0100 (CET) From: Ihor Radchenko To: Derek Chen-Becker Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] Cannot tangle src block in capture buffer [9.7.6] In-Reply-To: References: <2dijBN1CGUPtmZzcNXZAe54y8u0pC8V_DYIBCL4rSR1eh2s8TFJGW5V3q7pkiCRFtEHYXy66CU7F6kK3NN_VAX-R_RbAXptG0b5vOlUQsi8=@protonmail.com> <87y15bcbi1.fsf@localhost> <877c7zede2.fsf@localhost> <874j2z7a8u.fsf@localhost> <87ttatigrx.fsf@localhost> <87msfxd81c.fsf@localhost> <87sepox9oy.fsf@localhost> <87wmey7hmb.fsf@localhost> <87v7uhe0tg.fsf@localhost> Date: Wed, 15 Jan 2025 17:15:22 +0000 Message-ID: <878qrcdmmt.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: EFBFA54AF6 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 0.06 X-Spam-Score: 0.06 X-TUID: hhUhfFJ0o8r4 Derek Chen-Becker writes: > Before I submit the updated patch, does this look like a better approach? > > In the test for `org-base-buffer-file-name' I changed it to explicitly find > the current buffer file name and use that: > ... Looks like I was not clear enough in my last comment. The latest version of your patch exceeds 20LOC and cannot be accepted unless you have FSF copyright assignment. May I know if you have the assignment? If not, I suggest dropping `test-org-base-buffer-file-name' to not exceed the contribution size limit. > (let ((base-filename (buffer-file-name))) This looks right. > (let ((org-capture-templates '(("t" "Test" entry (here) "* Test > Header\n\n"))) > (base-filename (buffer-file-name))) > > (org-capture nil "t") This one is awkward. You can create an indirect buffer explicitly instead of relying upon implementation details of org-capture. > For the tangle test, I also capture the base buffer filename, use an > explicit tangle filename, and ensure that the call to `org-babel-tangle' > returns the expected list of tangled files: > > ;; See https://list.orgmode.org/87msfxd81c.fsf@localhost/T/#t > > (ert-deftest ob-tangle/tangle-from-capture-buffer () > > "Test tangling of source blocks from within a capture buffer. > > This is to ensure that we properly resolve the buffer name." > > (org-test-with-temp-text-in-file > > "* Header\n\nCapture after this point:\n" > > (let ((tangle-filename (format "%s.el" (buffer-file-name)))) I recommend using `org-babel-effective-tangled-filename' instead. This is more future-proof against possible changes in the way file name is computed. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at