diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2011-05-27 20:50:09 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2011-05-27 20:50:09 +0200 |
commit | bc161ded3693f752616dcd247fc9d638789025ee (patch) | |
tree | 3748a58191b34ebfd2186c82bda4a9ec78f807cf | |
parent | 5d1674f330b19da9142eb32784f99978b7988f2c (diff) | |
download | org-mode-bc161ded3693f752616dcd247fc9d638789025ee.tar.gz |
Capture: Store time from prompt in file+datetree+prompt target
* lisp/org-capture.el (org-capture-current-plist): Improve docstring.
(org-capture-put): Add docstring.
(org-capture-get): Add docstring.
(org-capture-member): Add LOCAL argument. Add docstring.
(org-capture-set-target-location): Store the time received from a date
prompt into the :prompt-time property.
When using the file+datetree+prompt target for capture, the time set
by the prompt is now stored in the :prompt-time property.
-rw-r--r-- | lisp/org-capture.el | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index ccfca75..7d3f630 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -343,23 +343,37 @@ The remember buffer is still current when this hook runs." (defvar org-capture-plist nil "Plist for the current capture process, global, to avoid having to pass it.") + (defvar org-capture-current-plist nil "Local variable holding the plist in a capture buffer. -This is used to store the plist for use when finishing a capture process. -Another such process might have changed the global variable by then.") +This is used to store the plist for use when finishing a capture process +because another such process might have changed the global variable by then. + +Each time a new capture buffer has been set up, the global `org-capture-plist' +is copied to this variable, which is local in the indirect buffer.") + (defvar org-capture-clock-keep nil "Local variable to store the value of the :clock-keep parameter. This is needed in case org-capture-finalize is called interactively.") (defun org-capture-put (&rest stuff) + "Add properties to the capture property list `org-capture-plist'." (while stuff (setq org-capture-plist (plist-put org-capture-plist (pop stuff) (pop stuff))))) (defun org-capture-get (prop &optional local) + "Get properties from the capture property list `org-capture-plist'. +When LOCAL is set, use the local variable `org-capture-current-plist', +this is necessary after initialization of the capture process, +to avoid conflicts with other active capture processes." (plist-get (if local org-capture-current-plist org-capture-plist) prop)) -(defun org-capture-member (prop) - (plist-get org-capture-plist prop)) +(defun org-capture-member (prop &optional local) + "Is PROP a preperty in `org-capture-plist'. +When LOCAL is set, use the local variable `org-capture-current-plist', +this is necessary after initialization of the capture process, +to avoid conflicts with other active capture processes." + (plist-get (if local org-capture-current-plist org-capture-plist) prop)) ;;; The minor mode @@ -745,16 +759,17 @@ already gone. Any prefix argument will be passed to the refile command." (org-datetree-find-date-create (calendar-gregorian-from-absolute (cond - (org-overriding-default-time ;; use the overriding default time (time-to-days org-overriding-default-time)) ((eq (car target) 'file+datetree+prompt) ;; prompt for date - (time-to-days (org-read-date - nil t nil "Date for tree entry:" - (current-time)))) + (let ((prompt-time (org-read-date + nil t nil "Date for tree entry:" + (current-time)))) + (org-capture-put :prompt-time prompt-time) + (time-to-days prompt-time))) (t ;; current date, possible corrected for late night workers (org-today)))))) |