diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f4f54d295..7a135243b 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-06-15 Carsten Dominik + + * org-remember.el (org-remember-apply-template): Access the + default time stored by `org-store-link'. + + * org.el (org-store-link-set-default-date): New function. + 2008-06-15 Carsten Dominik * org.el (org-beginning-of-line): Cater for the case when there diff --git a/lisp/org-remember.el b/lisp/org-remember.el index a14e45d16..ec6571804 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -314,6 +314,7 @@ to be run from that hook to function properly." (let* ((entry (org-select-remember-template use-char)) (tpl (car entry)) (plist-p (if org-store-link-plist t nil)) + (default-time (plist-get org-store-link-plist :default-time)) (file (if (and (nth 1 entry) (stringp (nth 1 entry)) (string-match "\\S-" (nth 1 entry))) (nth 1 entry) @@ -469,7 +470,7 @@ to be run from that hook to function properly." (char (setq org-time-was-given (equal (upcase char) char)) (setq time (org-read-date (equal (upcase char) "U") t nil - prompt)) + prompt default-time)) (org-insert-time-stamp time org-time-was-given (member char '("u" "U")) nil nil (list org-end-time-was-given))) diff --git a/lisp/org.el b/lisp/org.el index 8b18a020c..f7453e86c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6524,6 +6524,7 @@ For file links, arg negates `org-context-in-file-links'." (interactive "P") (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset + (org-store-link-set-default-date) (let (link cpltxt desc description search txt) (cond @@ -6658,6 +6659,24 @@ For file links, arg negates `org-context-in-file-links'." (setq org-store-link-plist (plist-put org-store-link-plist key value))))) +(defun org-store-link-set-default-date () + "Store the date at the cursor so that remember templates can access it. +This works in the calendar, and in the Org Agenda. It is a no-op in +any other modes." + (cond + ((eq major-mode 'calendar-mode) + (let ((date (calendar-cursor-to-date)) day defd) + (setq defd (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))) + ((eq major-mode 'org-agenda-mode) + (let* ((day (get-text-property (point) 'day)) + date) + (if day + (setq date (calendar-gregorian-from-absolute day) + defd (encode-time 0 0 0 (nth 1 date) (nth 0 date) + (nth 2 date))))))) + (when defd + (org-store-link-props :default-time defd))) + (defun org-email-link-description (&optional fmt) "Return the description part of an email link. This takes information from `org-store-link-plist' and formats it