From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.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 mA+7JFzxg2fL6gAAqHPOHw:P1 (envelope-from ) for ; Sun, 12 Jan 2025 16:44:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id mA+7JFzxg2fL6gAAqHPOHw (envelope-from ) for ; Sun, 12 Jan 2025 17:44:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ep9R7Ote; 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=1736700251; 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=MbK40IhGoFnnrvcsR4xRo4lMiVtl89EaUlzZ+Vzg3kY=; b=jsIVnpC2gNxBsDAMgpJvT6dYjlB1d0kPTUk3ZcHEmauuq+zyJAnK2q6ftAdt1mqHKoZjPV KcDRyisKoTEGCBuu2Az42Y//EJD9IzsEewaUJrKaVlJlMmYiZRieMhd963nOfzvPOspJXf FsGExl+AwzOLonxzvPPs4+p86ot2IFOxRPKWOTMD7s2da0ReBe2Qu5NRWz01qxJKsqZpSo Bfm/HkYhlX3QSkyEYd5hHiNYuKfokg86JDGUTManKJbCl9UPIvykq9wSw4dgLmNodHdwWm BNR8dVyQ963izURaGx61N4qH4DW05xNOLJ6edOG3jm/ITI05lk71AhAPTgXDsg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ep9R7Ote; 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=1736700251; a=rsa-sha256; cv=none; b=j56s/l5F7/AYjv3hVzihMuMj/1g1zgtE2wh/egGhIOjFkqQSYv9JF9Eyu6uaz/F68pMafR jstHkur1FTp7Oi8Qq6n4n813+XMZlJ5iBpUzlk8ia1T50qkNe+AYvb9RhZDNpOZ9z2z2B7 acLt/1+ylNROoqENwBGZiswKRnC7QEfp6JdxxLrXZ+lCJWUXGx0F/CgJqduLcna2Db/+Sj E2v887NL68CMPTdQhqpJU69nkGu1x04UYP2ihKQk5ZyALgghQh6REq6yIkEXeEs55qyBc1 lUGADk1pQYa19IVYODfuiTGzBbBHFauCnENuUb4yUsNJO9HHSsOs5ZTLhcHLpA== 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 6472F50182 for ; Sun, 12 Jan 2025 17:44:11 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tX13f-0003Iz-F4; Sun, 12 Jan 2025 11:43:27 -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 1tX13c-0003Iq-Kw for emacs-orgmode@gnu.org; Sun, 12 Jan 2025 11:43:24 -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 1tX13a-0002Xa-EQ for emacs-orgmode@gnu.org; Sun, 12 Jan 2025 11:43:24 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 62010240028 for ; Sun, 12 Jan 2025 17:43:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736700199; bh=ZOJHjMl2j415uqXYt8IDBoh+utYKzktMwdiKp2xcyJw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=ep9R7OterxfiRlKE62BGtEYAGnzbahLQTcDkCxiBh+0XDq0sCwb3wnF1+RyDG9I7o /w5sCZuS55berZbi96Ybrjb5uYPoQhhfLHsHVDWW/QlzNBzbn/tqd75AtoI8BrPRK6 LPW8eStq3m96ZrPSJzVIPx6Acy0q7aKFt0A+S0bkBY2Dh+b+ujBZ9o2E8BZaMPLa/K a0UAzr5wY2LZfCM3A8eSex1F9feaDpFtF66VzdWP9kFWcK5NCWjMcEd+h81+GE2b5i VJ1P3+hHIHs0X8kfh4AsnLqXNHn5isSOCKOJdZ606vtVkvfmGJjv3c+lbh8bxY8VcG eosuIDOAGw6Aw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YWLmk6QTWz9rxK; Sun, 12 Jan 2025 17:43:18 +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> Date: Sun, 12 Jan 2025 16:45:33 +0000 Message-ID: <87sepox9oy.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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 6472F50182 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 0.05 X-Spam-Score: 0.05 X-TUID: gEAXDvFagDgh Derek Chen-Becker writes: > OK, I've attached the patch. It wasn't clear from > https://orgmode.org/worg/org-contribute.html#first-patch whether this > should be sent in the thread or as a new thread. I can start a new one if > needed. Thanks! The same thread is the right place - we want everything related to the same bug report discussed in the same thread. Also, see https://orgmode.org/worg/org-contribute.html#fixbug > +(defun org-base-buffer-file-name (&optional BUFFER) > + "Resolve the base file name for the provided BUFFER. > +If BUFFER is not provided, default to the current buffer. If > +BUFFER does not have a file name associated with it (e.g. a > +transient buffer) then return nil." > + (buffer-file-name (buffer-base-buffer BUFFER))) What if BUFFER is provided, but that buffer is already a base buffer? Your function will then return file name for _current buffer_, not BUFFER. Also, what about other places in the code that use `buffer-file-name'? We may want to use the new function there as well. > +** Keep test artifacts > + > +Set the ~TEST_NO_AUTOCLEAN~ variable to leave the test directory > +around for inspection. Thanks for helping to improve the documentation here, but may you (1) sepearate it into a new patch (this change is not relevant to `buffer-file-name' bug); (2) maybe give an example of how to set TEST_NO_AUTOCLEAN. > +;; 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" > + (should > + (progn > + (let ((org-capture-templates '(("t" "Test" entry (here) "* Test Header\n\n")))) > + (org-capture nil "t") > + (goto-char (point-max)) > + (insert " > +#+begin_src elisp :tangle yes :comments org > + (message \"FOO\") > +#+end_src") > + (search-backward "message") > + (org-babel-tangle 4)))))) This will leave the tangled file lying around. Please explicitly remove it via (unwind-protect ... (delete-file ) See how `org-test-with-temp-text-in-file' macro does it. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at