Rodrigo Morales <rodrigo.mora...@utec.edu.pe> writes: > * The issue > > When setting org-id-link-to-org-use-id to t, an :ID: property is created > for each headline that contain at least one code block that is > tangled.
Confirmed The fix is attached. Best, Ihor
>From 0ed6b52b8ded461ad6d172b9c2d49fd36d5df129 Mon Sep 17 00:00:00 2001 Message-Id: <0ed6b52b8ded461ad6d172b9c2d49fd36d5df129.1626006467.git.yanta...@gmail.com> From: Ihor Radchenko <yanta...@gmail.com> Date: Sun, 11 Jul 2021 20:25:21 +0800 Subject: [PATCH] Avoid creating ID property during tangling * lisp/ob-tangle.el (org-babel-tangle-single-block, org-babel-tangle-comment-links): Suppress org-id-link-to-org-use-id during tangling. The links used during tangle process are transient and do not really need to use ID. Using ID may create unexpected edits in the tangled Org buffer when org-id-link-to-org-use-id is set to t. Fixes [1]. [1] https://orgmode.org/list/9eb31da73b12fcaf6820484834cc8cd3@libre.brussels/T/#t --- lisp/ob-tangle.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 2f60ef9a4..cec658f66 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -420,7 +420,14 @@ (defun org-babel-tangle-single-block (block-counter &optional only-this-block) (extra (nth 3 info)) (coderef (nth 6 info)) (cref-regexp (org-src-coderef-regexp coderef)) - (link (let ((l (org-no-properties (org-store-link nil)))) + (link (let* ( + ;; The created link is transient. Using ID is + ;; not necessary, but could have side-effects if + ;; used. An ID property may be added to + ;; existing entries thus creatin unexpected file + ;; modifications. + (org-id-link-to-org-use-id nil) + (l (org-no-properties (org-store-link nil)))) (and (string-match org-link-bracket-re l) (match-string 1 l)))) (source-name @@ -506,7 +513,13 @@ (defun org-babel-tangle-comment-links (&optional info) (number-to-string (line-number-at-pos)))) ("file" . ,(buffer-file-name)) - ("link" . ,(org-no-properties (org-store-link nil))) + ("link" . ,(let (;; The created link is transient. Using ID is + ;; not necessary, but could have side-effects if + ;; used. An ID property may be added to + ;; existing entries thus creatin unexpected file + ;; modifications. + (org-id-link-to-org-use-id nil)) + (org-no-properties (org-store-link nil)))) ("source-name" . ,name)))))) (list (org-fill-template org-babel-tangle-comment-format-beg link-data) (org-fill-template org-babel-tangle-comment-format-end link-data)))) -- 2.31.1