|
@@ -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
|