From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6CLCBfzrOWKUXQAAgWs5BA (envelope-from ) for ; Tue, 22 Mar 2022 16:32:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id COTZOfvrOWJqwAAAG6o9tA (envelope-from ) for ; Tue, 22 Mar 2022 16:32:11 +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 70AE82BA2D for ; Tue, 22 Mar 2022 16:32:11 +0100 (CET) Received: from localhost ([::1]:59282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWgUU-0004Qs-1o for larch@yhetil.org; Tue, 22 Mar 2022 11:32:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWgT4-0004QB-P2 for emacs-orgmode@gnu.org; Tue, 22 Mar 2022 11:30:42 -0400 Received: from [2607:f8b0:4864:20::331] (port=42894 helo=mail-ot1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWgT3-0007oB-13 for emacs-orgmode@gnu.org; Tue, 22 Mar 2022 11:30:42 -0400 Received: by mail-ot1-x331.google.com with SMTP id t8-20020a0568301e2800b005b235a56f2dso12721422otr.9 for ; Tue, 22 Mar 2022 08:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=KunuipBMlg6fQtxgMLyFZNIOCvLcLXwMZV67COQFkSM=; b=e3AQj/DTF2KB86VxBPsXhJ6c2coQ4mrKPXNwmxT/NYa+Im+NDWzfTaaVQ8qh0yn47g 5ssDrDWQkkZrH8lTxfS5I50SAd6EsnflyAHXzXKxbYbv3YySGTS1ZQWNaasPip0fsag1 cXrogbMmTUFWwtd3Mw7xTttxrqBqn7MamQG6AxjVHnLdNqWHKuwQS8XtK69bLNpxGZHq DqDCyWhlzRdaU2IqFbFfdmkPbi9S0TgaBZr7zVa0oZPj/Maa0OAuPPIj43yUfM9g63zo cUsbKkGl07y52Xsp+7qxGM9BN3HeX6rpJWz37ObNSHB05K6xqGwXBc14Wp/KQcyeUlVi WtWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=KunuipBMlg6fQtxgMLyFZNIOCvLcLXwMZV67COQFkSM=; b=2WWRfxS7SIZDYy2oNcTR/GvGkY41GYUEsQRhguuBdkOw20x961xWwsYCdNeMPyECi3 jEZFWSJRliG5rKjYYWWSM18GcGG3rA+etPncry/Jt6QGwZvwOx2Ha5bl9KMoy0/tfGOn 5sVCaJIftQ8MRw3yLVsCYpfXX6ezX4TZVkpFGrSAuhO564dtBfywUQDbktCF3Lvol2b6 OpMbYxDaCKsrOJocNq1J7hvVbC/1zFFoRgcoq72yuBvfbaZkWuuD/wUhnAQ+/2ZMUS3J AfmLGSUbSFaSXi9TH/nIkxO+TFWExD5V1dsPdNRAIdnbD5tH9N84t+Q9mJ2QVc99U+fo dDAQ== X-Gm-Message-State: AOAM530XookKWUJR/K/Fiig9iE+j5hU99mpWerKp/3MaR9jYgt4ktxJg LIN0tsMjT/ayp+AwrsAgniKxcgpxQQA= X-Google-Smtp-Source: ABdhPJx6mFUqQiOcZKwAPYFiYRLZEP157Nbhi5hP2wNEdoEyy0SPOGJZdc17wCtA4LprMYTSTW0D1Q== X-Received: by 2002:a9d:57c7:0:b0:5b2:3d6d:6469 with SMTP id q7-20020a9d57c7000000b005b23d6d6469mr10291699oti.301.1647963038221; Tue, 22 Mar 2022 08:30:38 -0700 (PDT) Received: from ergo ([186.236.209.77]) by smtp.gmail.com with ESMTPSA id 15-20020aca110f000000b002da58c4ec52sm9007755oir.6.2022.03.22.08.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 08:30:36 -0700 (PDT) From: =?utf-8?Q?Jo=C3=A3o?= Pedro de Amorim Paula To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= Subject: Re: Move or rename a file in a link In-Reply-To: <87ilsadw13.fsf@posteo.net> References: <87lexotblq.fsf@posteo.net> <878rti98d3.fsf@gmail.com> <878rthj1mm.fsf@posteo.net> <87pmmjgkjy.fsf@gmail.com> <87ilsadw13.fsf@posteo.net> Date: Tue, 22 Mar 2022 12:30:32 -0300 Message-ID: <87cziem2cn.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::331 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=jpedrodeamorim@gmail.com; helo=mail-ot1-x331.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647963131; 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=KunuipBMlg6fQtxgMLyFZNIOCvLcLXwMZV67COQFkSM=; b=MSzEvLdlq+R923bH4nLRS+qKk90CUO4YAgHyWuxl7tuuFTtIpATK5SUSXQxirm+/C8nJXR g/soXwF4abBTfrUbNLLsOGCT4jk5BdYy2uvSCeNiJVcM5O7DBZE/Ukhgm2FfnWYhqcfO2E KliumGIpQNIgFaH2TRc1qLdvxJvu1ISSIL5EpxYaL/VgcHKblzbwyc6njbecbuLVh9+dy0 31UXf3aSXNET4rKXpWkWVPH+85VRZlxhMYCFnoRhrgNEhtBMsrN2k/W8Mn7Kt10Edkacj7 37uUesr01ZJ1/OtNSVa5Z4hWncOdNAn+d+CmfmZPNA3zjCTgy6JtCUwofx4p5g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647963131; a=rsa-sha256; cv=none; b=KSTRO8RpLnNRkg2Yyysyducjd3du3nqj7anHNeplp9qaV8nq+dEaV87z0gzCCagheFFByI COl7p75aW+LcOwOdsXJtOUcwEVXrm6RVdwLf7xxbkJpKrdbQMAZlcm9J9bxSTwgqwE/egB dk9rf4IMpH37/budKTRWCL9KWsVDMd9qNt+/bzLGur0GV4VzYkqaRxIDInrFTeui+SlrCy vz+firxr2CLrxe2d4Gb0mIbpK11dnkZMxoVEaq6Lpkq0nmGzM/XGBdUKHxALe11tTf0ZNd FOO/no672kNgXIreNGgNjJ/ytN3YrrBZPwnbUB4b2vXuFiFuCPvyGRbw+iK8tw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="e3AQj/DT"; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -9.01 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="e3AQj/DT"; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 70AE82BA2D X-Spam-Score: -9.01 X-Migadu-Scanner: scn0.migadu.com X-TUID: u5SVeKkSCM3p --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 T24gMTkgTWFyY2ggMjAyMiAxMToyNSwgSnVhbiBNYW51ZWwgTWFjw61hcyA8bWFjaWFzY2hhaW5A cG9zdGVvLm5ldD4gd3JvdGU6DQoNCj4gIytiZWdpbl9zcmMgZW1hY3MtbGlzcA0KPiAgIChkZWZ1 biBteS1vcmctcmVuYW1lLWxpbmstZmlsZS1hdC1wb2ludCAoKQ0KPiAgICAgKGludGVyYWN0aXZl KQ0KPiAgICAgKGxldCogKChjdXJyLWRpciAoaWYgKGVxdWFsIChvcmctZWxlbWVudC1wcm9wZXJ0 eSA6dHlwZSAob3JnLWVsZW1lbnQtY29udGV4dCkpICJhdHRhY2htZW50IikNCj4gCQkJIChjb25j YXQgKGFiYnJldmlhdGUtZmlsZS1uYW1lIChvcmctYXR0YWNoLWRpcikpICIvIikNCj4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QkJCSAgICAgY3Vyci1kaXIgIiIgbmV3LXBhdGgpKQ0KPiAJKG15LW9yZy1yZXBsYWNlLWxp bmstZmlsZSBjdXJyZW50LXBhdGgNCj4gCQkJCSAgKHJlcGxhY2UtcmVnZXhwLWluLXN0cmluZw0K PiAJCQkJICAgY3Vyci1kaXIgIiIgbmV3LXBhdGgpKSkpKQ0KPg0KPiAgIChkZWZ1biBteS1vcmct cmVwbGFjZS1saW5rLWZpbGUgKGZyb20gdG8pDQo+ICAgICAoc2F2ZS1leGN1cnNpb24NCj4gICAg ICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkNCj4gICAgICAgKHdoaWxlIChyZS1zZWFyY2gtZm9y d2FyZCBvcmctYnJhY2tldC1saW5rLXJlZ2V4cCBuaWwgdCkNCj4gCShjb25kICgoc3RyaW5nLW1h dGNoLXAgKGNvbmNhdCAiYXR0YWNobWVudDoiIGZyb20pIChtYXRjaC1zdHJpbmcgMSkpDQo+IAkg ICAgICAgKHJlcGxhY2UtbWF0Y2ggKGNvbmNhdCAiW1thdHRhY2htZW50OiIgdG8gIl1dIikpKQ0K PiAJICAgICAgKChzdHJpbmctbWF0Y2gtcCBmcm9tIChtYXRjaC1zdHJpbmcgMSkpDQo+IAkgICAg ICAgKHJlcGxhY2UtbWF0Y2ggKGNvbmNhdCAiW1tmaWxlOiIgdG8gIl1dIikpKSkpKSkNCj4gIytl bmRfc3JjDQoNCkp1c3QgYSBjb3VwbGUgb2YgZml4ZXMgYW5kIGl0IHNlZW1zIHRvIGJlIHdvcmtp bmcgZmluZS4NCg0K --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=org-rename-link.patch diff -u a/org-rename-link.el b/org-rename-link.el --- a/org-rename-link.el 2022-03-22 12:08:45.790727092 -0300 +++ b/org-rename-link.el 2022-03-22 12:25:31.500218923 -0300 @@ -23,8 +23,11 @@ (defun my-org-replace-link-file (from to) (save-excursion (goto-char (point-min)) - (while (re-search-forward org-bracket-link-regexp nil t) - (cond ((string-match-p (concat "attachment:" from) (match-string 1)) - (replace-match (concat "[[attachment:" to "]]"))) - ((string-match-p from (match-string 1)) - (replace-match (concat "[[file:" to "]]"))))))) + (while (re-search-forward org-link-bracket-re nil t) + (replace-match + (cond + ((string-match-p (format "^attachment:%s\\'" from) (match-string 1)) + (format "attachment:%s" (file-name-nondirectory to))) + ((string-match-p (format "^file.*:%s\\'" from) (match-string 1)) + (format "file:%s" to))) + nil nil nil 1)))) Diff finished. Tue Mar 22 12:26:56 2022 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpBbGwgdGhpcyBwYXRjaCBkb2VzIGlzIHRvIHJlbW92ZSB0aGUgZGlyZWN0b3J5IG5hbWUgZnJv bSB0aGUNCj1hdHRhY2htZW50OmZpbGUuZXh0PSAtLSBnaXZlbiB0aGF0IHRoZSBwYXRoIGlzIGNh bGN1bGF0ZWQgYnkgb3JnLWF0dGFjaA0KLS0sIGFuZCB1c2UgdGhlIGdyb3VwIDEgb2YgdGhlIG1h dGNoIHN0cmluZyAoYXMgd2VsbCBhcyB1cGRhdGluZyB0aGUgdXNlDQpvZiBhbiBvYnNvbGV0ZSB2 YXJpYWJsZSksIHdoaWNoIGNvcnJlc3BvbmRzIHRvIHRoZSBhY3R1YWwgbGluayBwb3J0aW9uLA0K bGVhdmluZyB0aGUgZGVzY3JpcHRpb24gdW5jaGFuZ2VkLg0KDQpDb3JkaWFsbHksDQoNCi0tIA0K Sm/Do28gUGVkcm8gZGUgQS4gUGF1bGENCklUIHVuZGVyZ3JhZHVhdGUgYXQgVW5pdmVyc2lkYWRl IEZlZGVyYWwgZG8gUmlvIEdyYW5kZSBkbyBOb3J0ZSAoVUZSTikNCg== --=-=-=--