From 2a5bf43b8ce112eab30df55f25e1744a7b388d64 Mon Sep 17 00:00:00 2001 From: "Jorge A. Alfaro Murillo" Date: Sat, 6 Sep 2014 18:01:20 -0400 Subject: [PATCH] org-agenda.el: Refresh appointments from org files * lisp/org-agenda.el (org-agenda-to-appt): Double prefix arg refresh only the list of appointments that come from org files. Uses the text-properties in appt-time-msg-list to see if an entry has an org-heading property. TINYCHANGE --- lisp/org-agenda.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index bcbacf0..ff4a448 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -10046,7 +10046,9 @@ tag and (if present) the flagging note." (defun org-agenda-to-appt (&optional refresh filter &rest args) "Activate appointments found in `org-agenda-files'. With a \\[universal-argument] prefix, refresh the list of -appointments. +appointments. With a double prefix arg \\[universal-argument] +\\[universal-argument], refresh only the list of appointments +that come from org files. If FILTER is t, interactively prompt the user for a regular expression, and filter out entries that don't match it. @@ -10076,7 +10078,15 @@ details and examples. If an entry has a APPT_WARNTIME property, its value will be used to override `appt-message-warning-time'." (interactive "P") - (if refresh (setq appt-time-msg-list nil)) + (if (equal refresh '(4)) + (setq appt-time-msg-list nil)) + (if (equal refresh '(16)) + (let (new-appt-time-msg-list) + (dolist (entry appt-time-msg-list) + (if (not (text-property-any 1 (length (cadr entry)) + 'org-heading t (cadr entry))) + (add-to-list 'new-appt-time-msg-list entry))) + (setq appt-time-msg-list new-appt-time-msg-list))) (if (eq filter t) (setq filter (read-from-minibuffer "Regexp filter: "))) (let* ((cnt 0) ; count added events @@ -10119,8 +10129,6 @@ to override `appt-message-warning-time'." (and (stringp evt-filter) (string-match evt-filter evt))))))) (wrn (get-text-property 1 'warntime x))) - ;; FIXME: Shall we remove text-properties for the appt text? - ;; (setq evt (set-text-properties 0 (length evt) nil evt)) (when (and ok tod) (setq tod (concat "00" (number-to-string tod)) tod (when (string-match -- 2.0.1