Use agenda/calendar date as default for remember templates.

This applies only when the remember process gets started in the
agenda or calendar buffer.
This commit is contained in:
Carsten Dominik 2008-06-15 07:07:41 +02:00
parent d4398d9ba6
commit 2003d83370
3 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2008-06-15 Carsten Dominik <dominik@science.uva.nl>
* 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 <dominik@science.uva.nl>
* org.el (org-beginning-of-line): Cater for the case when there

View File

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

View File

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