Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Created Oct 18, 2012
Embed
What would you like to do?
;;
;; Allow automatically handing of created/expired meta data.
;;
(require 'org-expiry)
;; Configure it a bit to my liking
(setq
org-expiry-created-property-name "CREATED" ; Name of property when an item is created
org-expiry-inactive-timestamps t ; Don't have everything in the agenda view
)
(defun mrb/insert-created-timestamp()
"Insert a CREATED property using org-expiry.el for TODO entries"
(org-expiry-insert-created)
(org-back-to-heading)
(org-end-of-line)
(insert " ")
)
;; Whenever a TODO entry is created, I want a timestamp
;; Advice org-insert-todo-heading to insert a created timestamp using org-expiry
(defadvice org-insert-todo-heading (after mrb/created-timestamp-advice activate)
"Insert a CREATED property using org-expiry.el for TODO entries"
(mrb/insert-created-timestamp)
)
;; Make it active
(ad-activate 'org-insert-todo-heading)
(require 'org-capture)
(defadvice org-capture (after mrb/created-timestamp-advice activate)
"Insert a CREATED property using org-expiry.el for TODO entries"
; Test if the captured entry is a TODO, if so insert the created
; timestamp property, otherwise ignore
(when (member (org-get-todo-state) org-todo-keywords-1)
(mrb/insert-created-timestamp)))
(ad-activate 'org-capture)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment