diff options
author | Bastien Guerry <bzg@altern.org> | 2012-08-14 10:09:40 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-08-14 10:09:40 +0200 |
commit | fdcf9dceb7c5e9b61aea199a4025f43f56a1f68a (patch) | |
tree | a4a77bd01372d4957ea092b8c92b30221939c911 | |
parent | 944fd9d651633e2137ba75de6b6fe6b85aa75897 (diff) | |
download | org-mode-fdcf9dceb7c5e9b61aea199a4025f43f56a1f68a.tar.gz |
org-datetree.el: New option `org-datetree-add-timestamp'
* org-datetree.el (org-datetree-add-timestamp): New option.
(org-datetree-insert-line): Use it.
-rw-r--r-- | lisp/org-datetree.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el index e4bf6ad..b39dc44 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) |