emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* http://orgmode.org/org.html - org-agenda-to-appt
@ 2007-10-15 18:51 Richard G Riley
  2007-10-16  0:07 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Richard G Riley @ 2007-10-15 18:51 UTC (permalink / raw)
  To: org-mode


Just FYI : in 5.12c I tried 

org-agenda-to-appt as documented here:

http://orgmode.org/org.html#Weekly_002fDaily-agenda

but it doesn't appear to exist. I realise that the online doc is
probably a bit out of date with the development going on.

In addition, I would like to suggest that a "make install" also invokes
a "make doc" and/or "make install-info".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: http://orgmode.org/org.html - org-agenda-to-appt
  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>
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2007-10-16  0:07 UTC (permalink / raw)
  To: emacs-orgmode

Richard G Riley <rileyrgdev@googlemail.com> writes:

> org-agenda-to-appt as documented here:
>
> http://orgmode.org/org.html#Weekly_002fDaily-agenda
>
> but it doesn't appear to exist. 

Well, it does here (5.12c) - what did you tried?

-- 
Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: http://orgmode.org/org.html - org-agenda-to-appt
       [not found]   ` <azzlyjvc3i.fsf@home.net>
@ 2007-10-16  8:36     ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2007-10-16  8:36 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-16  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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).