From a865abb5fe7d2de10bfe31553865baf247b0af32 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 1 Aug 2012 16:05:47 +0200 Subject: [PATCH] Let's a :APPT_WARNTIME: property override `appt-message-warning-time' in `org-agenda-to-appt'. * org.el (org-speed-commands-default): New speedy command to quickly add the :APPT_WARNTIME: property. * org-agenda.el (org-agenda-to-appt): Use the :APPT_WARNTIME: property to override `appt-message-warning-time' when adding an appointment from an entry. * org.texi (Weekly/daily agenda): Mention APPT_WARNTIME and its use in `org-agenda-to-appt'. This feature has been suggested, along with preliminary patches, by Ivan Kanis. Thanks! --- doc/org.texi | 12 +++++++----- lisp/org-agenda.el | 12 +++++++++--- lisp/org.el | 2 ++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 46201c85f..8a64da575 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -7520,11 +7520,13 @@ in an Org or Diary file. @cindex appointment @cindex reminders -Org can interact with Emacs appointments notification facility. To add all -the appointments of your agenda files, use the command -@code{org-agenda-to-appt}. This command also lets you filter through the -list of your appointments and add only those belonging to a specific category -or matching a regular expression. See the docstring for details. +Org can interact with Emacs appointments notification facility. To add the +appointments of your agenda files, use the command @code{org-agenda-to-appt}. +This command lets you filter through the list of your appointments and add +only those belonging to a specific category or matching a regular expression. +It also reads a @code{APPT_WARNTIME} property which will then override the +value of @code{appt-message-warning-time} for this appointment. See the +docstring for details. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views @subsection The global TODO list diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index dc907582b..d62b9686b 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8973,7 +8973,10 @@ belonging to the \"Work\" category. ARGS are symbols indicating what kind of entries to consider. By default `org-agenda-to-appt' will use :deadline, :scheduled and :timestamp entries. See the docstring of `org-diary' for -details and examples." +details and examples. + +If an entry as 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 (eq filter t) @@ -9013,7 +9016,8 @@ details and examples." (or (and (stringp cat-filter) (string-match cat-filter cat)) (and (stringp evt-filter) - (string-match evt-filter evt)))))))) + (string-match evt-filter evt))))))) + (wrn (org-entry-get (point) "APPT_WARNTIME"))) ;; FIXME: Shall we remove text-properties for the appt text? ;; (setq evt (set-text-properties 0 (length evt) nil evt)) (when (and ok tod) @@ -9022,7 +9026,9 @@ details and examples." "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)\\'" tod) (concat (match-string 1 tod) ":" (match-string 2 tod)))) - (appt-add tod evt) + (if (version< emacs-version "23.3") + (appt-add tod evt) + (appt-add tod evt wrn)) (setq cnt (1+ cnt))))) entries) (org-release-buffers org-agenda-new-buffers) (if (eq cnt 0) diff --git a/lisp/org.el b/lisp/org.el index 25b9a2329..7933d4726 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18021,6 +18021,8 @@ BEG and END default to the buffer boundaries." (";" . org-set-tags-command) ("e" . org-set-effort) ("E" . org-inc-effort) + ("W" . (lambda(m) (interactive "sMinutes before warning: ") + (org-entry-put (point) "APPT_WARNTIME" m))) ("Agenda Views etc") ("v" . org-agenda) ("/" . org-sparse-tree) -- 2.11.4.GIT