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 6Bw+MDaeX2dgGgEAqHPOHw:P1 (envelope-from ) for ; Mon, 16 Dec 2024 03:27:51 +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 6Bw+MDaeX2dgGgEAqHPOHw (envelope-from ) for ; Mon, 16 Dec 2024 04:27:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=chen-becker.org header.s=google header.b=fY1ValOC; 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=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734319670; 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=5wlnhZNIY4kBVM0IKayVSnq067uvTEySA1pQia/qeto=; b=T1oHE2aRnWi1CdKsxvaDGQ9IZZtdNeEEuoectl9DMxlklNXMKulfz5V6MNbD67eW4Qf+Co lwGqB43ibHb5Z3HXDN1rff6sJo6ZUXHyY8gvbiB0tAFEwvWTQVXsGW8Vr45XpsPIGb0v79 rwFLqcW1YtR+mkrVFb9F5eeRecp1b3EnkGqJK7NrnCZ3d7JL2uMd8nfPu4AfNfuod/XuN/ cLs2Yf47OXxNzthm1HfR0+iJCb+1IyGK5XgPzIGhKcjPsTzLpkuZgszSXqbOXE7VCDqdDS pQaAVBc5ssnu3dO07Fb0VhB/eY844Ys6KVpJrngowdmMVMqhiReBYCrIT9D7/w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=chen-becker.org header.s=google header.b=fY1ValOC; 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=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734319670; a=rsa-sha256; cv=none; b=Pq4soLI955MM5sjimpR2vtq8fWj1kv2NblYOMZQp4XvrzlX3Bzjw4eCKXlG7l6GS5SRci7 auN3GD/ds9H+AxUyQCXOWvSpxJhpMoZO1daIYAXWWII4sqQM0Cqk51lcOCo3B1Agp/wKfE Fk2C83Qr2THtFKSiAEqiY1yP6fCg6CIhOqrUvGgO4IUTmsULoxxc0vYpzHnVbbEBq9HFJb gaan/ncgVbMyq75koejtBEqwqdOJYlyOkwzRg51XWQjM76z3Qejue1sZcWkVdlJWgf5lXr AMuVRVYfGIqLqDfVIKAPxrXCdazEfJib3TX2Lu84RNZYKE0uAAABTTJ1gDtb8w== 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 16D467BF47 for ; Mon, 16 Dec 2024 04:27:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tN1kz-0001hG-1i; Sun, 15 Dec 2024 22:26:53 -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 1tN1kx-0001gm-Hw for emacs-orgmode@gnu.org; Sun, 15 Dec 2024 22:26:51 -0500 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tN1kv-0002xK-NK for emacs-orgmode@gnu.org; Sun, 15 Dec 2024 22:26:51 -0500 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3a816cc9483so26025815ab.3 for ; Sun, 15 Dec 2024 19:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chen-becker.org; s=google; t=1734319607; x=1734924407; darn=gnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5wlnhZNIY4kBVM0IKayVSnq067uvTEySA1pQia/qeto=; b=fY1ValOC3pOqYObkbW9+gcLexhera4Q7jSTjO3ZUwWfSHwMKiAO8XyXkG44/cWtWjp csaYCu+n1bJ2NkPvGfz1TLs4PTCJ/Mp/aOAbu3VYhVE58WBWsN+mhQxCDqsBCLwsAXO+ J1KqWsZImSr9OW7N2Oo8cYExw9fG7dR/Xg7YHVFej4/NhIIUIc1IhAVx4oHPTWE5/7df RkkUX4EmYHfZ0XTitqRA214fFhntehKxQa40GJ18Arq5KKYV3u+MemcLzzQvb1M3pQDw haSp1HaBLcY7t2zGwhVBvWigdVI5uiG6QYbxmk3BojDCx9mBl60fOWCeM1o3D+gAXLVy 0gJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734319607; x=1734924407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5wlnhZNIY4kBVM0IKayVSnq067uvTEySA1pQia/qeto=; b=o6TLXcMgIrUPlvUczvOKkCW9tBu3iKHo8muZ5+EgvjFBYWC4dqaKQcqBnw1nu/4OEK 2AWqneB5EhGniBQHGzNj+E4Vzc1/XFwaDOzlwTW6X/RulnBs1r345YYOjUaE1k+1+N2M fI26pvpOFKptvjWt6nzdYfP6T44U1FcVsx4kDR1TGR3EHF29aOkwyQ8kmS6NqTJix5hX Pc3DU+DnAk5/MbFWmwSVDacYADi9YbxoocQvK55TSWfdkczUUas1tKyE/kG7CM9zLurR UqSSy8D5Pb9hbr5XQSTQD0uMTOu32OrtWuiX8Yi0yAWDv0OaQDDnpFOvmDGRxZ4Zu6AL RKRw== X-Gm-Message-State: AOJu0YzFvcgHrpOWVb61q0gFFvsjEBWIJydWUS8z44wdPNPMTNpHAKNP CFUXxRFGgjl0n2ChVZ9xVhrRNRZTlKiyUUfywBxdiR/B7wzczIuOQwGtL0F0GEI= X-Gm-Gg: ASbGnct57KOkq1vMhbGjUGoIRKpqR0rzW2VTFfw6tf/ochV+o1O9YH1d/RCKBvIdptr hx5FF5HgOc6D2POHJQ0cTHcjGe9jt+XQOh9A5Zf+mmM8gQfsEjBoeSuLiJU5Lrp4hQh5Le+I+ly E6CZCYoaoF8hW2p+lTYw3KNPi6h3rz7Ug9LcjUPH6QV7zaRVr411rd5IrfRhnFlt0AuSR9pHrY1 7WvgU6d2NOj9FtA5LDSA+WD3jp42LTMrB01sYLCHL9UfCvpp6t+K+aF0MPV4PC9Hy4Ze7GmxXaF 0mL5TmOIug== X-Google-Smtp-Source: AGHT+IHPvyWFdD3meSTEXzT4l/jCqa9q64z2b4fK3LP5tj66daXZmDbzlk84sTwKEgapn8klyDC+fQ== X-Received: by 2002:a05:6e02:16c8:b0:3a7:81a4:a557 with SMTP id e9e14a558f8ab-3affa1caeabmr120615395ab.24.1734319607042; Sun, 15 Dec 2024 19:26:47 -0800 (PST) Received: from chen-becker.org (64-98-50-17.tingfiber.net. [64.98.50.17]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3b24d9d2070sm13133745ab.75.2024.12.15.19.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 19:26:46 -0800 (PST) Date: Sun, 15 Dec 2024 20:26:44 -0700 From: Derek Chen-Becker To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] Cannot tangle src block in capture buffer [9.7.6] Message-ID: References: <2dijBN1CGUPtmZzcNXZAe54y8u0pC8V_DYIBCL4rSR1eh2s8TFJGW5V3q7pkiCRFtEHYXy66CU7F6kK3NN_VAX-R_RbAXptG0b5vOlUQsi8=@protonmail.com> <87y15bcbi1.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BReexLRC9Opp12fb" Content-Disposition: inline In-Reply-To: <87y15bcbi1.fsf@localhost> Received-SPF: pass client-ip=2607:f8b0:4864:20::133; envelope-from=derek@chen-becker.org; helo=mail-il1-x133.google.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, 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.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 16D467BF47 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -6.50 X-Spam-Score: -6.50 X-TUID: 6hAPRNsIHIAF --BReexLRC9Opp12fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 05, 2024 at 02:03:50PM +0000, Ihor Radchenko wrote: > That's because capture buffer is an indirect buffer and indirect buffers > are technically not associated with any file. >=20 > We should probably fix handling indirect buffers across Org mode. >=20 > Confirmed. >=20 OK, after some debugging it looks like the primary culprit is the assignmen= t of source-file from buffer-file-name. A quick patch seems to fix it, but I can definitely see a pattern here if org funct= ions are trying to get the filename of the current buffer (I can submit an official patch if this looks right): modified lisp/ob-tangle.el @@ -269,7 +269,7 @@ matching a regular expression." (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'no-eva= l)))) (user-error "Point is not in a source code block")))) path-collector - (source-file buffer-file-name)) + (source-file (buffer-file-name (buffer-base-buffer)))) (mapc ;; map over file-names (lambda (by-fn) (let ((file-name (car by-fn))) There are 339 uses of buffer-file-name that I can find, but most are just b= are (buffer-file-name). Are there any other cases besides indirect buffers that we would need to handle? Would it be worth cr= eating a new function "org-buffer-file-name" that could properly handle indirect buffers and any other special cases, or is i= t just a search and replace throughout? Cheers, Derek --=20 +---------------------------------------------------------------+ | Derek Chen-Becker | | http://chen-becker.org | | | | GPG Key available at https://keybase.io/dchenbecker and | | https://pgp.mit.edu/pks/lookup?search=3Dderek%40chen-becker.org | | Fngrprnt: EB8A 6480 F0A3 C8EB C1E7 7F42 AFC5 AFEE 96E4 6ACC | +---------------------------------------------------------------+ --BReexLRC9Opp12fb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE64pkgPCjyOvB539Cr8Wv7pbkaswFAmdfnfQACgkQr8Wv7pbk asySjBAAjDRslLtovHKL4I2gWfPipycRlF6TZoxSNLbxAOs/NYpXMLjW9RmUGy60 2Njg4Ue2xl2PWWzJWBI7wiHybJXktOgmoPxgPJi+ESBqi4COowROUeQqFwPMnkmf WWeCuYGDeR+YhnRpxgCFR392NEcHJo5e/JrQldOM72NsxErBezFitGNYG6GgoM0f WcG0AcTVXNhQ1spVPQ16w0gws3jShZ/8Q5Lx2v2KnlWDBPHutLgoWfsk0k7dcJTY 0wnxIOmw7pnJAmztagQqs0HNWYt6XAoJCMwcGkvTxBQ5njDfS6bpItZeSGIDCaI0 C8q3QLoT6o14KHVaJcI0ne1wxODgRxHgNCw7r48j/wJ2h5CXmSBVsBtMCer7qNoZ 08BBC+EyQ9B3/sxHF6rFAH1ZY5n3biM4bDzMTNM6K1KEko+l9U770zUGJfDnGHCC 21po6kE9+9H0LTErPMCDD/8bALykFqcTagp2MIeGpAfcCspCdf09dJM+yhCuy1SE muTqtAYgyQrSDQySt8mnETK5ac19swTyTuBxtSVIvF8aPII8I0h7JLXUYEF27pxI xgf8MU/0cy2ieB6Rg2l/DR+aJMRSl6z/Ew/+S9KpS9lU+j8/UVl2aDwl8v82k2ui HGrP4uI3hhqxmxWalB4LuWU8tmKljS0kY3mQjlZLFgrFEesec/w= =w82Q -----END PGP SIGNATURE----- --BReexLRC9Opp12fb--