Whenever I create org-mode
entries using org-capture
they automatically get an ID property. Is it possible to disable that? I'm using org mode version 9.0.5.
3 Answers
Setting org-id-link-to-org-use-id
to create-if-interactive
will prevent org-capture
from creating links, thus prevent creating the ID drawer.
(setq org-id-link-to-org-use-id 'create-if-interactive)
The documentation for org-id-link-to-org-use-id
says:
create-if-interactive
If org-store-link is called directly (interactively, as a user
command), do create an ID to support the link. But when doing the
job for capture, only use the ID if it already exists. The
purpose of this setting is to avoid proliferation of unwanted
IDs, just because you happen to be in an Org file when you
call org-capture that automatically and preemptively creates a
link. If you do want to get an ID link in a capture template to
an entry not having an ID, create it first by explicitly creating
a link to it, using C-c l first.
EDIT: this feature seems to exist since 2008. See this commit: https://code.orgmode.org/bzg/org-mode/commit/ac83bc01d7c5b8d625e1a61ecb0f759f49e85c65
So I think I've found a way, but its not very elegant:
(defun org-remove-id-from-last-capture ()
"Remove ID property from last `org-capture' entry, save capture buffer."
(let* ((properties (org-entry-properties org-capture-last-stored-marker))
(file (cdr (assoc "FILE" properties))))
(when (org-entry-delete org-capture-last-stored-marker "ID")
(with-current-buffer (get-file-buffer file)
(save-buffer)))))
(add-hook 'org-capture-after-finalize-hook #'org-remove-id-from-last-capture)
Sorry this answer may be better go to comment but I don't have enough reputation.
Short Version: It there any possibility that you used any package related with bookmarks or global-jump to org heading? If so, then trying to disable them may be helpful.
Long Version: I happened to have the same problem that an ID will be attached and stop the clock-in timer if there is any.
Following steps are done for a capture to finalize: (would be incomplete):
- Insert the capture content to target location
- Save a bookmark called "org-capture-last-stored" to your Bookmarks
- Save the target file
And in my case, I found no function related to org-id in step 1 and 3 but in step 2, there is one package called "org-bookmark-heading" which is used to jump to a heading from bookmark. It will take over when creating a bookmark and generate the ID.
In all, I would suggest to check any packages related to bookmarks, head creation and save-hook.
org-mode
9.0.5 would force users to create ID when launching a neworg-capture
. I'd bet my lunch money that you have changed the default settings which inadvertently createed this issue.org-id-link-to-org-use-id
and see if you are doing something as described ...org-capture
, it is created after storing the capture (so I can't see the ID property in the capture buffer). I think its a good thing to use ID properties usually, but in this case I did not want them. Myorg-id-link-to-org-use-id
isnil
. I haven't anything related to IDs in my init-file. Perhaps one of my otherorg-mode
related installed packages do something: worf, ox-reveal, interleave, org-ref, deft.emacs -Q
org-mode doesn't seem to create IDs by default. Then its org-mode version 8.2.10 though.