From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: http://orgmode.org/org.html - org-agenda-to-appt Date: Tue, 16 Oct 2007 09:36:32 +0100 Message-ID: <87d4vflalr.fsf@bzg.ath.cx> References: <87przfj50m.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ihgyh-0004ri-B7 for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 03:36:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ihgyf-0004qm-Qm for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 03:36:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ihgyf-0004qj-MA for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 03:36:33 -0400 Received: from hu-out-0506.google.com ([72.14.214.227]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ihgyf-0007Cy-45 for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 03:36:33 -0400 Received: by hu-out-0506.google.com with SMTP id 23so1577240huc for ; Tue, 16 Oct 2007 00:36:31 -0700 (PDT) In-Reply-To: (Richard G. Riley's message of "Tue, 16 Oct 2007 07:54:09 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Richard G Riley 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