emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] Setting org-id-link-to-org-use-id to t creates IDs properties when tangling
@ 2021-07-10 10:35 Rodrigo Morales
  2021-07-10 18:39 ` Jonathan McHugh
  2021-07-11 12:28 ` [PATCH] " Ihor Radchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Rodrigo Morales @ 2021-07-10 10:35 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3280 bytes --]


* 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.

* Reproducing this issue

1. Start emacs -Q

2. Open a "*.org" file at a location where you have write permissions
(this is because, apparently, tangling only works when the file is
correctly saved so this way we get rid of this possible issue)

3. Insert the following minimal working example into the buffer (you can
find the Org Mode file attached to this mail)

#+BEGIN_SRC org
,* foo

,#+HEADER: :tangle ~/Downloads/main.txt
,#+BEGIN_SRC text
a
,#+END_SRC

,* bar

,#+HEADER: :tangle ~/Downloads/main.txt
,#+BEGIN_SRC text
a
,#+END_SRC

,* fizz

,#+BEGIN_SRC text
a
,#+END_SRC
#+END_SRC

4. Execute the following commands

#+BEGIN_SRC emacs-lisp
(require 'org-id)
(setq org-id-link-to-org-use-id t)
#+END_SRC

5. Now, execute org-babel-tangle (C-c C-v C-t).

At this point, a id property is created for the "foo" and "bar"
headlines because those are the only headlines that contain a code
block. This is what I got in emacs -Q

#+BEGIN_SRC org
,* foo
  :PROPERTIES:
  :ID:       358560b4-2426-4d42-a498-ae16195daf3a
  :END:

,#+HEADER: :tangle ~/Downloads/main.txt
,#+BEGIN_SRC text
a
,#+END_SRC

,* bar
  :PROPERTIES:
  :ID:       02217461-a744-42b2-b582-1a836568d686
  :END:

,#+HEADER: :tangle ~/Downloads/main.txt
,#+BEGIN_SRC text
a
,#+END_SRC

,* fizz

,#+BEGIN_SRC text
a
,#+END_SRC
#+END_SRC

* Personal thoughts

In my opinion, this is undesired behavior because the goal of
org-id-link-to-org-use-id isn't creating an ID property for each
headline when performing tangling.

* Major undesired consequences

The following is an scenario in which this issue causes major undesired
consequences: Consider the following scenario

+ you have 1000 headlines in an Org Mode file

+ all of those headlines don't have an ID property (because you are not
  interested in uniquely identifying all of those headlines through an ID)
  
+ all of those headlines contain at least one code block that is tangled

Because of this issue, the following would be added for each headline

#+BEGIN_SRC org
,* my headline
:PROPERTIES:
:ID: <<an auto-generated id>>
:END:
#+END_SRC

and this have the following undesired consequences

+ You would end up with 3000 lines in your Org Mode file because of the
  id properties even when you weren't interested in creating an ID for
  each of those headlines.
  
+ You would have 1000 more entries in org-id-locations-file (again, even
  where you weren't interested in creating an ID for each of those
  headlines)


-- 
La información contenida en este e-mail y sus anexos es confidencial, 
privilegiada y está dirigida exclusivamente a su destinatario, en 
consecuencia, solo puede ser utilizada por aquel. Si usted no es el 
destinatario original, no deberá examinar, usar, copiar o distribuir este 
mensaje o la información que contiene. Si lo recibe por error, por favor 
reenvíelo a la persona que se lo envió y elimínelo. Cualquier retención o 
uso total o parcial no autorizada de este mensaje está estrictamente 
prohibida y sancionada por ley.

[-- Attachment #2: main.org --]
[-- Type: text/plain, Size: 189 bytes --]

* foo

#+HEADER: :tangle ~/Downloads/main.txt
#+BEGIN_SRC text
a
#+END_SRC

* bar

#+HEADER: :tangle ~/Downloads/main.txt
#+BEGIN_SRC text
a
#+END_SRC

* fizz

#+BEGIN_SRC text
a
#+END_SRC

[-- Attachment #3: Type: text/plain, Size: 237 bytes --]



-- 
[[[ If you see a signature in spanish below/above this message, please
omit it. It is automatically inserted in all my messages due to the
internal privacy policies of the organization that owns the domain of my
email address. ]]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-08 12:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-10 10:35 [bug] Setting org-id-link-to-org-use-id to t creates IDs properties when tangling Rodrigo Morales
2021-07-10 18:39 ` Jonathan McHugh
2021-07-11 12:28 ` [PATCH] " Ihor Radchenko
2021-09-26  6:59   ` Bastien
2023-07-29  7:01     ` Ihor Radchenko
2023-08-08 12:56       ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).