From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.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 mIi7MjuQYGcrUgAA62LTzQ:P1 (envelope-from ) for ; Mon, 16 Dec 2024 20:40:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id mIi7MjuQYGcrUgAA62LTzQ (envelope-from ) for ; Mon, 16 Dec 2024 21:40:27 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=P0WmlnCb; 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=1734381627; 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=fQsEDS9b0amNmlzaidTQE1Horn7vUdfp8BTGK5wlLEs=; b=EoxDAVFL4n6R9poB8PpNmpROSgH6aM620gmpc7Mpqhl9TPk6maDMcQYOx11DwnlSLJtf87 VpGHStWL6ymw/CtBck+IAtuqwuq/PzYOtaGPjNDjyISFP/S1SS68vzEtgeM8DLQE5tyDS4 A3NFaMGE7MmhOPOigU5qAr9Vtnv/BalttrnXgtncIkXZR/y91xPKpimpaCEalMPVqOz2mx bA1LoKIAoBzWBSVEV1LprcRuO4xHtmTyZxi43PUdhbdOAVFJP5zUunKW+phb9aigMkfv3M tsRX4eejovAuX5bx2epwjm8MnZzyIVY/thw+yyELWayZd6Zw2/LcvyOxwdkb4A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=P0WmlnCb; 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=1734381627; a=rsa-sha256; cv=none; b=idA5CdwkTetE+/ZTnMWd9G/g2W2XawPKfleulLtDI/b3Whu6FjquEgvvgxs85YtMjqqVXG +mDaecZ/0CvXj65SFO+4VPGtHUAKu2IY0Qbe4b49qn/xmkJDC17XSsAfnHqr67yLWS4KB5 wdCG/MgBkwL9JjO4ylYo3I1vbXp0nSCWiE1Ni4IJTU9gTtN8unyS9DnQ2vBwQiudmD9rsK DGWEc6Yg4MObEpb5yKd3KSiaWWyt71LdzFCO/uHgQo/U4jh9ftcJJUvNnReH0M6bM3WXYi ataeQtWjWxhXgWKzgPTqnC6EFV4iHswChSApM+MBE8pNagQeDdWOCBJE7yFJfw== 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 7A8A47B350 for ; Mon, 16 Dec 2024 21:40:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNF2M-0006Hm-Sz; Mon, 16 Dec 2024 12:37:43 -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 1tNF2J-0006HC-5B for emacs-orgmode@gnu.org; Mon, 16 Dec 2024 12:37:39 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNF2H-0003ZP-2R for emacs-orgmode@gnu.org; Mon, 16 Dec 2024 12:37:38 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 72655240101 for ; Mon, 16 Dec 2024 18:37:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1734370653; bh=Mez4kf0XH60hc3wq88W8+dnEyrb4AuJaRS0XmJa8NwE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=P0WmlnCbJG3lX40dan3GED+fBczxDdNjtmEcEA2HClOKu3VLCTwzU4Hcd2KzUJzNh WVImQKZC9eTn9ZHZ9YbFvVEXVX6A7RndXcGjK7rFYb+szOOT6wMnnh9+T8GYgNO2nR MCLm520tYG6EEvLarwY2i4zuP27E+fLH0WuTfB5TghtLTm7ymc4/izYH53yACZfZlY L5HtjpQvnxjkJbc2xGfXtK5AkhEQvmL1mhRXIsiYAyN3V1xXiNKX46dKWhde6AUUf7 inB41P81J9l/SCuL2lPLDA8g5C9ZZuQ6OSvPSa1h59zgesYDv+zUzp1KIWibnNkGU4 TqiyI4DXE+IJw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YBnFm6ykMz9rxD; Mon, 16 Dec 2024 18:37:32 +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> Date: Mon, 16 Dec 2024 17:39:01 +0000 Message-ID: <877c7zede2.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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_H3=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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 7A8A47B350 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -3.68 X-Spam-Score: -3.68 X-TUID: e131s8aFP1px Derek Chen-Becker writes: > OK, after some debugging it looks like the primary culprit is the assignment of source-file from buffer-file-name. A quick > patch seems to fix it, but I can definitely see a pattern here if org functions 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-eval)))) > (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))) This looks right, yes. > There are 339 uses of buffer-file-name that I can find, but most are just bare (buffer-file-name). Are there any other cases > besides indirect buffers that we would need to handle? Would it be worth creating a new function "org-buffer-file-name" that > could properly handle indirect buffers and any other special cases, or is it just a search and replace throughout? I can think of two scenarios: 1. indirect Org buffer, as you pointed 2. a new Org buffer not yet associated with file. Even base buffer will then have buffer-file-name returning nil May we have a special function? If it is going to be used 339 times, definitely yes ;) Although, I'd prefer more telling name like `org-base-buffer-file-name' (akin the existing `org-with-base-buffer' macro) -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at