From e16f281abea7aba06e2e60dd6fef7faafd22c7d2 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 17 Mar 2014 21:18:28 -0700 Subject: [PATCH] Add commands to add ids to org mode buffers --- .emacs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.emacs b/.emacs index 9c7b047..30f236c 100644 --- a/.emacs +++ b/.emacs @@ -135,6 +135,19 @@ (org-remove-empty-drawer-at "LOGBOOK" (point)))) (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append) +; add ids on creation of nodes +(add-hook 'org-capture-prepare-finalize-hook 'org-id-get-create) +; create function to create headlines in file. This comes from +; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode +(defun my/org-add-ids-to-headlines-in-file () + "Add ID properties to all headlines in the current file which +do not already have one." + (interactive) + (org-map-entries 'org-id-get-create)) +; if we wanted to do this to every buffer, do the following: +; (add-hook 'org-mode-hook +; (lambda () +; (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local))) ; resolve clocks after 10 minutes of idle; use xprintidle -- 2.39.2