Browse Source

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
Ihor Radchenko 3 năm trước cách đây
mục cha
commit
0b4e357d62
1 tập tin đã thay đổi với 15 bổ sung2 xóa
  1. 15 2
      lisp/ob-tangle.el

+ 15 - 2
lisp/ob-tangle.el

@@ -417,7 +417,14 @@ non-nil, return the full association list to be used by
 	 (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
@@ -500,7 +507,13 @@ by `org-babel-get-src-block-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))))