1

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.

6
  • 3
    It is difficult to believe that org-mode 9.0.5 would force users to create ID when launching a new org-capture. I'd bet my lunch money that you have changed the default settings which inadvertently createed this issue. – lawlist Feb 20 '17 at 8:47
  • Have a look at the doc-string org-id-link-to-org-use-id and see if you are doing something as described ... – lawlist Feb 20 '17 at 8:59
  • The ID is not created when launching 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. My org-id-link-to-org-use-id is nil. I haven't anything related to IDs in my init-file. Perhaps one of my other org-mode related installed packages do something: worf, ox-reveal, interleave, org-ref, deft. – Erik Sjöstrand Feb 20 '17 at 9:04
  • But yes, using emacs -Q org-mode doesn't seem to create IDs by default. Then its org-mode version 8.2.10 though. – Erik Sjöstrand Feb 20 '17 at 9:10
  • Please post the relevant capture template if you can. And read more about templates here: orgmode.org/manual/Capture-templates.html – biocyberman Apr 21 '17 at 14:44
0

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)
0

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):

  1. Insert the capture content to target location
  2. Save a bookmark called "org-capture-last-stored" to your Bookmarks
  3. 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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.