Sfoglia il codice sorgente

Update `org-agenda-to-appt'.

Added `refresh' as the first argument for this function.
A value of `t' for the filter argument now means: prompt
the user for a regular expression and filter out entries
that don't match it.

Don't run `appt-check' inside `org-agenda-to-appt' since
appt-check might already find agenda appointments in the
diary file if it contains (org-diary ...).

Removed the declare-function for appt-check.

Cleaned up the ChangeLog for these changes.
Bastien Guerry 18 anni fa
parent
commit
7c0d910bd8
2 ha cambiato i file con 26 aggiunte e 22 eliminazioni
  1. 6 5
      ChangeLog
  2. 20 17
      org.el

+ 6 - 5
ChangeLog

@@ -1,11 +1,12 @@
 2008-02-26  Bastien Guerry  <Bastien.Guerry@ens.fr>
 2008-02-26  Bastien Guerry  <Bastien.Guerry@ens.fr>
 
 
-	* org.el (org-agenda-to-appt): Don't set
-	`org-deadline-warning-days' to nil, but use a different list of
-	arguments for `org-agenda-get-day-entries'.  Also refresh the list
-	of appointments.
+	* org.el (org-agenda-to-appt): New argument `refresh' let the user
+	delete previous appointments stored in `appt-time-msg-list'.
+	Remove :deadline from the args of `org-agenda-get-day-entries'
+	instead of setting `org-deadline-warning-days' to nil.
 	(org-deadline-warning-days): Mention the fact that a value of zero
 	(org-deadline-warning-days): Mention the fact that a value of zero
-	will also be enforced.
+	will be treated like negative values.
+	(org-show-todo-tree): Fix a small typo in the docstring.
 
 
 2008-02-26  Carsten Dominik  <dominik@science.uva.nl>
 2008-02-26  Carsten Dominik  <dominik@science.uva.nl>
 
 

+ 20 - 17
org.el

@@ -2708,8 +2708,8 @@ nearest into the future."
 (defcustom org-deadline-warning-days 14
 (defcustom org-deadline-warning-days 14
   "No. of days before expiration during which a deadline becomes active.
   "No. of days before expiration during which a deadline becomes active.
 This variable governs the display in sparse trees and in the agenda.
 This variable governs the display in sparse trees and in the agenda.
-When negative or null, it means use the absolute value of this number
-even if a deadline has a different individual lead time specified."
+When negative or null, use the absolute value of this number even if 
+a deadline has a different individual lead time specified."
   :group 'org-time
   :group 'org-time
   :group 'org-agenda-daily/weekly
   :group 'org-agenda-daily/weekly
   :type 'number)
   :type 'number)
@@ -4195,8 +4195,6 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
 ;; FIXME: get the argument lists for the UNKNOWN stuff
 ;; FIXME: get the argument lists for the UNKNOWN stuff
 (declare-function add-to-diary-list "diary-lib"
 (declare-function add-to-diary-list "diary-lib"
                   (date string specifier &optional marker globcolor literal))
                   (date string specifier &optional marker globcolor literal))
-(defvar appt-time-msg-list)
-(declare-function appt-check "appt" (&optional force))
 (declare-function table--at-cell-p "table" (position &optional object at-column))
 (declare-function table--at-cell-p "table" (position &optional object at-column))
 (declare-function Info-find-node "info" (filename nodename &optional no-going-back))
 (declare-function Info-find-node "info" (filename nodename &optional no-going-back))
 (declare-function Info-goto-node "info" (nodename &optional fork))
 (declare-function Info-goto-node "info" (nodename &optional fork))
@@ -14856,7 +14854,7 @@ This function should be run in the `org-after-todo-state-change-hook'."
   "Make a compact tree which shows all headlines marked with TODO.
   "Make a compact tree which shows all headlines marked with TODO.
 The tree will show the lines where the regexp matches, and all higher
 The tree will show the lines where the regexp matches, and all higher
 headlines above the match.
 headlines above the match.
-With \\[universal-argument] prefix, also show the DONE entries.
+With a \\[universal-argument] prefix, also show the DONE entries.
 With a numeric prefix N, construct a sparse tree for the Nth element
 With a numeric prefix N, construct a sparse tree for the Nth element
 of `org-todo-keywords-1'."
 of `org-todo-keywords-1'."
   (interactive "P")
   (interactive "P")
@@ -18579,29 +18577,32 @@ If there is already a time stamp at the cursor position, update it."
       (org-insert-time-stamp
       (org-insert-time-stamp
        (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
        (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
 
 
+(defvar appt-time-msg-list)
+
 ;;;###autoload
 ;;;###autoload
-(defun org-agenda-to-appt (&optional filter)
+(defun org-agenda-to-appt (&optional refresh filter)
   "Activate appointments found in `org-agenda-files'.
   "Activate appointments found in `org-agenda-files'.
-When prefixed, prompt for a regular expression and use it as a
-filter: only add entries if they match this regular expression.
+With a \\[universal-argument] prefix, refresh the list of
+appointements. 
+
+If FILTER is t, interactively prompt the user for a regular
+expression, and filter out entries that don't match it.
 
 
-FILTER can be a string. In this case, use this string as a
-regular expression to filter results.
+If FILTER is a string, use this string as a regular expression
+for filtering entries out.
 
 
-FILTER can also be an alist, with the car of each cell being
+FILTER can also be an alist with the car of each cell being
 either 'headline or 'category.  For example:
 either 'headline or 'category.  For example:
 
 
   '((headline \"IMPORTANT\")
   '((headline \"IMPORTANT\")
     (category \"Work\"))
     (category \"Work\"))
 
 
 will only add headlines containing IMPORTANT or headlines
 will only add headlines containing IMPORTANT or headlines
-belonging to the category \"Work\"."
+belonging to the \"Work\" category."
   (interactive "P")
   (interactive "P")
   (require 'calendar)
   (require 'calendar)
-  (require 'appt)
-  (setq appt-time-msg-list nil)
-  (save-window-excursion (appt-check t))
-  (if (equal filter '(4))
+  (if refresh (setq appt-time-msg-list nil))
+  (if (eq filter t)
       (setq filter (read-from-minibuffer "Regexp filter: ")))
       (setq filter (read-from-minibuffer "Regexp filter: ")))
   (let* ((cnt 0) ; count added events
   (let* ((cnt 0) ; count added events
 	 (org-agenda-new-buffers nil)
 	 (org-agenda-new-buffers nil)
@@ -18639,7 +18640,9 @@ belonging to the category \"Work\"."
 	   (appt-add tod evt)
 	   (appt-add tod evt)
 	   (setq cnt (1+ cnt))))) entries)
 	   (setq cnt (1+ cnt))))) entries)
     (org-release-buffers org-agenda-new-buffers)
     (org-release-buffers org-agenda-new-buffers)
-    (message "Added %d event%s for today" cnt (if (> cnt 1) "s" ""))))
+    (if (eq cnt 0) 
+	(message "No event to add")
+      (message "Added %d event%s for today" cnt (if (> cnt 1) "s" "")))))
 
 
 ;;; The clock for measuring work time.
 ;;; The clock for measuring work time.