Richard G Riley <[EMAIL PROTECTED]> writes:
> I cleaned out and reinstalled - I have a feeling an old "root" .elc
> might have hidden the function, but now I get
>
> ,----
> | org-date-to-gregorian: Symbol's function definition is void:
> calendar-gregorian-from-absolute
> `----
>
> When I run org-agenda-to-appt interactively.
Try this one (will be fixed in 5.13):
;; Make appt aware of appointments from the agenda
(defun org-agenda-to-appt (&optional filter)
"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.
FILTER can be a string. In this case, use this string as a
regular expression to filter results.
FILTER can also be an alist, with the car of each cell being
either 'headline or 'category. For example:
'((headline \"IMPORTANT\")
(category \"Work\"))
will only add headlines containing IMPORTANT or headlines
belonging to the category \"Work\"."
(interactive "P")
(require 'org)
(require 'calendar)
(if (equal filter '(4))
(setq filter (read-from-minibuffer "Regexp filter: ")))
(let* ((cnt 0) ; count added events
(today (org-date-to-gregorian
(time-to-days (current-time))))
(files org-agenda-files) entries file)
;; Get all entries which may contain an appt
(while (setq file (pop files))
(setq entries
(append entries
(org-agenda-get-day-entries
file today
:timestamp :scheduled :deadline))))
(setq entries (delq nil entries))
;; Map thru entries and find if they pass thru the filter
(mapc
(lambda(x)
(let* ((evt (org-trim (get-text-property 1 'txt x)))
(cat (get-text-property 1 'org-category x))
(tod (get-text-property 1 'time-of-day x))
(ok (or (null filter)
(and (stringp filter) (string-match filter evt))
(and (listp filter)
(or (string-match
(cadr (assoc 'category filter)) cat)
(string-match
(cadr (assoc 'headline filter)) evt))))))
;; 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 (number-to-string tod)
tod (when (string-match
"\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod)
(concat (match-string 1 tod) ":"
(match-string 2 tod))))
(appt-add tod evt)
(setq cnt (1+ cnt))))) entries)
(message "Added %d event%s for today" cnt (if (> cnt 1) "s" ""))))
--
Bastien
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode