From fdcf9dceb7c5e9b61aea199a4025f43f56a1f68a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 14 Aug 2012 10:09:40 +0200 Subject: [PATCH] org-datetree.el: New option `org-datetree-add-timestamp' * org-datetree.el (org-datetree-add-timestamp): New option. (org-datetree-insert-line): Use it. --- lisp/org-datetree.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el index e4bf6ad44..b39dc4448 100644 --- a/lisp/org-datetree.el +++ b/lisp/org-datetree.el @@ -38,6 +38,15 @@ This is normally one, but if the buffer has an entry with a DATE_TREE property (any value), the date tree will become a subtree under that entry, so the base level will be properly adjusted.") +(defcustom org-datetree-add-timestamp nil + "When non-nil, add a time stamp when create a datetree entry." + :group 'org-capture + :version "24.2" + :type '(choice + (const :tag "Do not add a time stamp" nil) + (const :tag "Add an inactive time stamp" inactive) + (const :tag "Add an active time stamp" active))) + ;;;###autoload (defun org-datetree-find-date-create (date &optional keep-restriction) "Find or create an entry for DATE. @@ -119,7 +128,7 @@ tree can be found." (org-datetree-insert-line year month day))))) (defun org-datetree-insert-line (year &optional month day) - (let ((pos (point))) + (let ((pos (point)) ts-type) (skip-chars-backward " \t\n") (delete-region (point) pos) (insert "\n" (make-string org-datetree-base-level ?*) " \n") @@ -136,6 +145,10 @@ tree can be found." (insert (format " %s" (format-time-string "%B" (encode-time 0 0 0 1 month year)))))) + (when (and day (setq ts-type org-datetree-add-timestamp)) + (insert "\n") + (org-indent-line) + (org-insert-time-stamp (encode-time 0 0 0 day month year) nil ts-type)) (beginning-of-line 1))) (defun org-datetree-file-entry-under (txt date) -- 2.11.4.GIT