From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id cHn1DLT/XWXTdgEAG6o9tA:P1 (envelope-from ) for ; Wed, 22 Nov 2023 14:18:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cHn1DLT/XWXTdgEAG6o9tA (envelope-from ) for ; Wed, 22 Nov 2023 14:18:44 +0100 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 C5FEC5A885 for ; Wed, 22 Nov 2023 14:18:43 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b="J/Gtqflk"; 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=reject) header.from=mailbox.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700659124; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=UYJPb3NOJ/2xn0oV3YyjvNBzzAxGagSiPKjDiNhCHu8=; b=qrLK90JCms9JXGss5XAMlVsNYTC8a3Cg/sFxIaPvIQhcHJHTkLPv0qFCVRZMqQ+7ZaGpKh K92lWxUqg/LC0JSqe3SD7SS6UOHhzx7biT+2IAsSjruQU69rHu0adepc/nx+srknYfTJo+ gxa48xp3KR4P2M4egtEd+rSwq3tss91zf66527sVnMDUSU0Vrs1rXACTIVV1Zpj3qVEJAH QJUzzzEzGeF5Fa69sPzDVognmEUa9A9MXN2RHSMkurTh5n4iRHzZBBkFBm3VzMan0L8mj1 SgquDPKZsabCzHJ1jhuLTYNZQO01MsKjxJlHs+FukdwISt4rnsoVkrMds35M7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b="J/Gtqflk"; 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=reject) header.from=mailbox.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700659124; a=rsa-sha256; cv=none; b=mypd3I37gP1nkbNkeViXRPgjoOz4OPIV8ur7aotlGgkWu2A+UlR+Ia0COERc22lPJqoSfh 7nCQDgp7GEw8ou0YeVnj8iUj4flgI4Jq04rL/EZfo2oo2eE/bjCNRHQNNq6vA7/zzJull1 kWiQDYf1+eyKhj9wOnnUlGPf5zHuAsImBLj8K4K66iZRMGXfP+J8dW37RouBO6GOYUUEuL kYz5GL//yC7DuoapZHdJ7hw1HHDPk6n9N7Yw5taAJ0LaFg1sFl2CoE1aFA8NfyaMm6MFJN Na4mmxtT9a5dxSo34tr36U8g5A6lgUveQq/ohq3/3Yp1LSTA1LyZkRMxzSRjqQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5n77-0000az-4W; Wed, 22 Nov 2023 08:17:57 -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 1r41jh-0001ql-4X for emacs-orgmode@gnu.org; Fri, 17 Nov 2023 11:30:29 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1r41jY-0003Zi-BG for emacs-orgmode@gnu.org; Fri, 17 Nov 2023 11:30:28 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4SX2SM1LyLz9tKq for ; Fri, 17 Nov 2023 17:30:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1700238611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=UYJPb3NOJ/2xn0oV3YyjvNBzzAxGagSiPKjDiNhCHu8=; b=J/Gtqflkyrcvu6C5SWje/sPBSJpi4KCLti5nWwum16X+lemGPpzq+z5BwxAIqETKDOVPOy weaSjG5kO11gXyl1Zep7gG32ElIHjj3nOn2DxIy5WxurFqS2N8vtTfRgZh8eFVBnyvCDA1 yNONGzfiLNnuPl+TjF0lMhJ+Ej5n1HspM0f15brONCjiT+/4LCRVx7CZqvLNEfM5Er4dsG YXCgg8gwh5uch9mH0XPZ/KtxLVrp9OGBrwLqc6d2w+urpIsUdB3wvnrs5dYoK0RGPNDyiF 1oG0GFatAPM6l1bKsr2mU644ikHNjhSdkMeNrdNYngoG+JucczoXghtcEdY2Sw== From: Antero Mejr To: emacs-orgmode@gnu.org Subject: [PATCH] Move files when using org-babel-tangle-publish Date: Fri, 17 Nov 2023 16:30:07 +0000 Message-ID: <87bkbsgx68.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-MBO-RS-ID: 1f3c9e0ef07ed7205c0 X-MBO-RS-META: sccu3ddtoqtnm1yeju4ccskbk1prr779 Received-SPF: pass client-ip=80.241.56.171; envelope-from=antero@mailbox.org; helo=mout-p-201.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 22 Nov 2023 08:17:44 -0500 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-Spam-Score: -8.76 X-Spam-Score: -8.76 X-Migadu-Queue-Id: C5FEC5A885 X-Migadu-Scanner: mx10.migadu.com X-TUID: xvDk0c5QoCty --=-=-= Content-Type: text/plain When publishing using org-babel-tangle-publish to the same directory that contains the org files, copy-file will signal an error, since the source and destination files refer to the same file. So use rename-file instead. When publishing to a different directory, this change also cleans up the old files, which matches the behavior of the other publishing functions like org-html-publish-to-html. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Move-files-when-using-org-babel-tangle-publish.patch >From c122cef65da00275e2f1a76cf74bbcb3838abea9 Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Fri, 17 Nov 2023 16:06:53 +0000 Subject: [PATCH] Move files when using org-babel-tangle-publish Fixes copy-file error when publishing to the current directory. Don't leave behind the old tangled files when publishing. * lisp/org/ob-tangle.el (org-babel-tangle-publish): Use rename-file instead of copy-file on tangled files. --- lisp/org/ob-tangle.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index a833037ca2b..9c8de839308 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -219,7 +219,8 @@ Return list of the tangled file names." (unless (file-exists-p pub-dir) (make-directory pub-dir t)) (setq pub-dir (file-name-as-directory pub-dir)) - (mapc (lambda (el) (copy-file el pub-dir t)) (org-babel-tangle-file filename))) + (mapc (lambda (el) (rename-file el pub-dir t)) + (org-babel-tangle-file filename))) ;;;###autoload (defun org-babel-tangle (&optional arg target-file lang-re) -- 2.41.0 --=-=-=--