Explorar o código

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!
Bastien Guerry %!s(int64=12) %!d(string=hai) anos
pai
achega
a865abb5fe
Modificáronse 3 ficheiros con 18 adicións e 8 borrados
  1. 7 5
      doc/org.texi
  2. 9 3
      lisp/org-agenda.el
  3. 2 0
      lisp/org.el

+ 7 - 5
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

+ 9 - 3
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)

+ 2 - 0
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)