From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Re: http://orgmode.org/org.html - org-agenda-to-appt
Date: Tue, 16 Oct 2007 09:36:32 +0100 [thread overview]
Message-ID: <87d4vflalr.fsf@bzg.ath.cx> (raw)
In-Reply-To: <azzlyjvc3i.fsf@home.net> (Richard G. Riley's message of "Tue, 16 Oct 2007 07:54:09 +0200")
Richard G Riley <rileyrgdev@googlemail.com> 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
prev parent reply other threads:[~2007-10-16 7:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 18:51 http://orgmode.org/org.html - org-agenda-to-appt Richard G Riley
2007-10-16 0:07 ` Bastien
[not found] ` <azzlyjvc3i.fsf@home.net>
2007-10-16 8:36 ` Bastien [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d4vflalr.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).