all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* diary behaving strangely
@ 2002-10-29 14:19 Tiarnan
  2002-10-29 15:36 ` ken
  0 siblings, 1 reply; 10+ messages in thread
From: Tiarnan @ 2002-10-29 14:19 UTC (permalink / raw)


Hi--

I've written a bit of lisp (based on code on the emacs Wiki) for
snarfing MS Outlook appointment messages and saving them to the emacs
diary. One problem... even though the correct entries are listed in
the diary when I call it as a file, they don't show up in the
appointments list. I've tried reloading diary (M-x diary), and even
reloading emacs, but still, the appointments are not recognised,
although they seem to be correctly formatted.

Can anyone help?

Here's the lisp:

(defun toc-outlook-invitation-to-diary ()
  (interactive)
  (let ((buffer (or (get-buffer "*Article*") (current-buffer))))
    (save-excursion
      (set-buffer buffer)
      (goto-char (point-min))
      (when (re-search-forward "^Subject: \\(.*\\)$")
	(setq subject (match-string 1))
	(beginning-of-buffer)
	(when (re-search-forward "^When: \\([0-9]+ \\w+\\) \\([0-9]+\\) \\([0-9]+:[0-9]+\\).*$")
	  (setq date (match-string 1))
	  (setq year (match-string 2))
	  (setq time (match-string 3))
	  (when (re-search-forward "^Where: \\(.*\\)$")
	    (setq where (match-string 1))
	    (setq diary-buffer (find-file-noselect diary-file))
	    (set-buffer diary-buffer)
	    (goto-char (point-max))
	    (insert (format "\n%s %s\n %s %s (%s)\n" date year time subject where))
	    (save-buffer)
	    (bury-buffer diary-buffer)))))))

-- 
Tiarnán Ó Corráin		CMG-WDSC
Sysadmin 			Cork.
tiarnan.o'corrain@cmg.com	+353-21-4933200

"Iraq: incredible weapons - incredible weapons." How do you know that? 
"Uh, well... We looked at the receipt." -- Bill Hicks, 1992

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

* Re: diary behaving strangely
  2002-10-29 14:19 diary behaving strangely Tiarnan
@ 2002-10-29 15:36 ` ken
  0 siblings, 0 replies; 10+ messages in thread
From: ken @ 2002-10-29 15:36 UTC (permalink / raw)
  Cc: help-gnu-emacs


Hey, Tiarnan,

Very interesting post-- on two counts.

I didn't know there was a way to pull Outlook appointments into an emacs
diary.  Thanks for letting me know about that.  Take a look at
<http://www.emacswiki.org/cgi-bin/wiki.pl?OutlookToDiary> and
<http://de.geocities.com/ulf_jasper/lisp/lookout.el.txt>.  They might
help your efforts.  Hope so.  

I'm peripherally involved in installing a Twiki server, so am 
interested in emacs client interfaces to it (but didn't know I was 
interested, didn't think such a thing existed, until your post).  

Thanks for providing these two pieces of good news.  If anyone comes 
across more info on either of these, please feel free to let me know.


tia,
ken

Spake Tiarnan at 14:19 (UTC-0000) on 29 Oct 2002:

= Hi--
= 
= I've written a bit of lisp (based on code on the emacs Wiki) for
= snarfing MS Outlook appointment messages and saving them to the emacs
= diary. One problem... even though the correct entries are listed in
= the diary when I call it as a file, they don't show up in the
= appointments list. I've tried reloading diary (M-x diary), and even
= reloading emacs, but still, the appointments are not recognised,
= although they seem to be correctly formatted.
= 
= ....

-- 
AMD crashes?  See http://cleveland.lug.net/~ken/amd-problem/.

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

* Re: diary behaving strangely
       [not found] <mailman.1035901228.11451.help-gnu-emacs@gnu.org>
@ 2002-10-29 16:08 ` Alan Shutko
  2002-10-29 16:37   ` Tiarnan
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Shutko @ 2002-10-29 16:08 UTC (permalink / raw)


Tiarnan <tiarnan.ocorrain@cmg.com> writes:

> One problem... even though the correct entries are listed in the
> diary when I call it as a file, they don't show up in the
> appointments list. 

Could you post a sample entry?  I don't have any Outlook meeting
notifications handy to test it on.  The appointment list uses
different parsing code than diary (on my list to fix in my CFT) and
is a bit pickier about format.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Our rotten system is as good as anyone else's rotten system.

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

* Re: diary behaving strangely
  2002-10-29 16:08 ` Alan Shutko
@ 2002-10-29 16:37   ` Tiarnan
  2002-10-29 16:48     ` Alan Shutko
  0 siblings, 1 reply; 10+ messages in thread
From: Tiarnan @ 2002-10-29 16:37 UTC (permalink / raw)
  Cc: help-gnu-emacs

>>>>> "AS" == Alan Shutko <ats@acm.org> writes:
    AS> Could you post a sample entry?  I don't have any Outlook
    AS> meeting notifications handy to test it on.  The appointment
    AS> list uses different parsing code than diary (on my list to fix
    AS> in my CFT) and is a bit pickier about format.

Here's a sample (between the ----s):
-----
29 October 2002
	16:45 Updated: Company Meeting (Canteen)
-----

and a sample entry that works:
-----
Jun 13, 2002 
	16:30-17:00 Company meeting in Canteen.
-----

I wonder if what I'm looking for is some kind of diary-refresh
function...


-- 
Tiarnán Ó Corráin		CMG-WDSC
Sysadmin 			Cork.
tiarnan.o'corrain@cmg.com	+353-21-4933200

"Iraq: incredible weapons - incredible weapons." How do you know that? 
"Uh, well... We looked at the receipt." -- Bill Hicks, 1992

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

* Re: diary behaving strangely
  2002-10-29 16:37   ` Tiarnan
@ 2002-10-29 16:48     ` Alan Shutko
  2002-10-30  9:03       ` Tiarnan
       [not found]       ` <mailman.1035968667.28019.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Shutko @ 2002-10-29 16:48 UTC (permalink / raw)
  Cc: help-gnu-emacs

Tiarnan <tiarnan.ocorrain@cmg.com> writes:

> 29 October 2002
> 	16:45 Updated: Company Meeting (Canteen)

You say that works in the diary display, but not the appointment list?

I think I may have been imprecise.

Does it show up if you are doing M-x diary?  

If not, the problem is probably that you don't have
european-calendar-style set to t.

Are you using the appointment reminder stuff, and it doesn't show up
in appt-time-msg-list?

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
I believe in Whirled Peas...

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

* Re: diary behaving strangely
  2002-10-29 16:48     ` Alan Shutko
@ 2002-10-30  9:03       ` Tiarnan
  2002-10-30 10:34         ` Tiarnan
       [not found]       ` <mailman.1035968667.28019.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Tiarnan @ 2002-10-30  9:03 UTC (permalink / raw)


>>>>> "AS" == Alan Shutko <ats@acm.org> writes:
    AS> Does it show up if you are doing M-x diary?

No it doesn't, though it's clearly visible in the ~/diary file.

    AS> If not, the problem is probably that you don't have
    AS> european-calendar-style set to t.

I have (setq european-calendar t) in .emacs, so I don't think that's
the problem. It's almost as if emacs gets the appointments for a day
when it is started up, and keeps them in some kinda internal form,
rather than rescanning the diary file.

Basically I'm adding the text to the bottom of the diary file, where
it doesn't seem to be picked up by the appointment reminders thingy or
M-x diary. Is there some sort of recommended way to add data to the
diary, rather than just shoving text at the end of it? If so, could
you give me an example of it, so I can amend the lisp code?

-- 
Tiarnán Ó Corráin		CMG-WDSC
Sysadmin 			Cork.
tiarnan.o'corrain@cmg.com	+353-21-4933200

"Iraq: incredible weapons - incredible weapons." How do you know that? 
"Uh, well... We looked at the receipt." -- Bill Hicks, 1992

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

* Re: diary behaving strangely
  2002-10-30  9:03       ` Tiarnan
@ 2002-10-30 10:34         ` Tiarnan
  0 siblings, 0 replies; 10+ messages in thread
From: Tiarnan @ 2002-10-30 10:34 UTC (permalink / raw)


>>>>> "T" == Tiarnan  <tiarnan.ocorrain@cmg.com> writes:
    AS> If not, the problem is probably that you don't have
    AS> european-calendar-style set to t.

Replying to myself... it seems that the problem was indeed the
calendar style---it only accepts diary entries in the form:

October 30, 2002
        blah blah blah

Once I amended the lisp to be slightly more careful about picking out
the date, month and year, I was able to drop correctly formatted
events into the diary, where they were picked up by the diary, and the
appointment list. Thanks to AS for the hint (disregarded at first). 

For anyone who is interested, here's the schnippet (largely purloined
from the example on the emacs Wiki):

(defun toc-outlook-invitation-to-diary ()
  (interactive)
  (let ((buffer (or (get-buffer "*Article*") (current-buffer))))
    (save-excursion
      (set-buffer buffer)
      (goto-char (point-min))
      (when (re-search-forward "^Subject: \\(.*\\)$")
	(setq subject (match-string 1))
	(beginning-of-buffer)
	(when (re-search-forward "^When: \\([0-9]+\\) \\(\\w+\\) \\([0-9]+\\) \\([0-9]+:[0-9]+\\).*$")
	  (setq day  (match-string 1))
	  (setq month (match-string 2))
	  (setq year (match-string 3))
	  (setq time (match-string 4))
	  (when (re-search-forward "^Where: \\(.*\\)$")
	    (setq where (match-string 1))
	    (setq diary-buffer (find-file-noselect diary-file))
	    (set-buffer diary-buffer)
	    (goto-char (point-max))
	    (insert (format "\n%s %s, %s\n\t%s %s (%s)\n" month day year time subject where))
	    (save-buffer)
	    (bury-buffer diary-buffer)))))))

Anyway, now I'm happy, since Outlook can disappear completely from my
desktop. Another positive example of the Law of Software Envelopment.

Cheers

Tiarnán

-- 
Tiarnán Ó Corráin		CMG-WDSC
Sysadmin 			Cork.
tiarnan.o'corrain@cmg.com	+353-21-4933200

"Iraq: incredible weapons - incredible weapons." How do you know that? 
"Uh, well... We looked at the receipt." -- Bill Hicks, 1992

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

* Re: diary behaving strangely
       [not found]       ` <mailman.1035968667.28019.help-gnu-emacs@gnu.org>
@ 2002-10-30 14:23         ` Alan Shutko
  2002-11-12  9:43           ` Colin Marquardt
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Shutko @ 2002-10-30 14:23 UTC (permalink / raw)


Tiarnan <tiarnan.ocorrain@cmg.com> writes:

> I have (setq european-calendar t) in .emacs, so I don't think that's
> the problem. It's almost as if emacs gets the appointments for a day
> when it is started up, and keeps them in some kinda internal form,
> rather than rescanning the diary file.

FYI (although you've solved the problem):

The diary re-reads the diary file every time the buffer is
generated.  However, it won't understand "20 October 2002" unless
european-calendar-style is set to t when emacs starts up, or you
modify diary-date-forms.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Now listen John, behave yourself or I'll murder you.

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

* Re: diary behaving strangely
  2002-10-30 14:23         ` Alan Shutko
@ 2002-11-12  9:43           ` Colin Marquardt
  2002-11-13  1:54             ` Edward M. Reingold
  0 siblings, 1 reply; 10+ messages in thread
From: Colin Marquardt @ 2002-11-12  9:43 UTC (permalink / raw)


[warming up an oldish thread...]

Alan Shutko <ats@acm.org> writes:

> The diary re-reads the diary file every time the buffer is
> generated.  However, it won't understand "20 October 2002" unless
> european-calendar-style is set to t when emacs starts up, or you
> modify diary-date-forms.

It seems that diary/calendar does not complain when it cannot parse a
date. It would probably be helpful if it printed a warning if (what
it thinks is the) month is bigger than 12, for example.

Cheers,
  Colin

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

* Re: diary behaving strangely
  2002-11-12  9:43           ` Colin Marquardt
@ 2002-11-13  1:54             ` Edward M. Reingold
  0 siblings, 0 replies; 10+ messages in thread
From: Edward M. Reingold @ 2002-11-13  1:54 UTC (permalink / raw)


>>>>> "CM" == Colin Marquardt <c.marquardt@alcatel.de> writes:

    CM> It seems that diary/calendar does not complain when it cannot parse a
    CM> date. It would probably be helpful if it printed a warning if (what it
    CM> thinks is the) month is bigger than 12, for example.

It is not possible to do that because the diary contents are free form and
any comment line is a non-date.  The only errors that can be trapped (and they
are) are errors in sexps.
-- 

Professor Edward M. Reingold                Email: reingold@iit.edu
Chairman, Department of Computer Science    Voice: (312) 567-3309
Illinois Institute of Technology            Assistant: (312) 567-5152
Stuart Building                             Fax:   (312) 567-5067
10 West 31st Street, Suite 236
Chicago, IL  60616-3729  U.S.A.

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

end of thread, other threads:[~2002-11-13  1:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-29 14:19 diary behaving strangely Tiarnan
2002-10-29 15:36 ` ken
     [not found] <mailman.1035901228.11451.help-gnu-emacs@gnu.org>
2002-10-29 16:08 ` Alan Shutko
2002-10-29 16:37   ` Tiarnan
2002-10-29 16:48     ` Alan Shutko
2002-10-30  9:03       ` Tiarnan
2002-10-30 10:34         ` Tiarnan
     [not found]       ` <mailman.1035968667.28019.help-gnu-emacs@gnu.org>
2002-10-30 14:23         ` Alan Shutko
2002-11-12  9:43           ` Colin Marquardt
2002-11-13  1:54             ` Edward M. Reingold

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.