Created
October 18, 2012 06:42
-
-
Save mrvdb/3910203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; 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