From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Hetzner Subject: Re: Fix for org-agenda-cleanup-fancy-diary Date: Wed, 01 Apr 2009 10:26:41 -0700 Message-ID: <49d3a3ad.0e538c0a.623d.ffff9e16@mx.google.com> References: <49d27cda.1f538c0a.3e43.0351@mx.google.com> <1ACBF12E-6592-4A9C-A487-330DDA9FFB6F@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============0094636576==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lp4Cb-0005qU-V6 for emacs-orgmode@gnu.org; Wed, 01 Apr 2009 13:26:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lp4CW-0005oV-PM for emacs-orgmode@gnu.org; Wed, 01 Apr 2009 13:26:13 -0400 Received: from [199.232.76.173] (port=57511 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lp4CW-0005oP-Az for emacs-orgmode@gnu.org; Wed, 01 Apr 2009 13:26:08 -0400 Received: from rv-out-0708.google.com ([209.85.198.248]:60756 helo=rv-out-0506.google.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lp4CV-0003Rz-Hy for emacs-orgmode@gnu.org; Wed, 01 Apr 2009 13:26:08 -0400 Received: by rv-out-0506.google.com with SMTP id k29so2324939rvb.2 for ; Wed, 01 Apr 2009 10:26:06 -0700 (PDT) In-Reply-To: <1ACBF12E-6592-4A9C-A487-330DDA9FFB6F@gmail.com> 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: Carsten Dominik Cc: emacs-orgmode@gnu.org --===============0094636576== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Apr__1_10:26:41_2009-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Wed_Apr__1_10:26:41_2009-1 Content-Type: multipart/mixed; boundary="Multipart_Wed_Apr__1_10:26:41_2009-1" --Multipart_Wed_Apr__1_10:26:41_2009-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable At Wed, 1 Apr 2009 13:18:09 +0200, Carsten Dominik wrote: > > Hi Erik, > > can you show > > - an example entry > - how it shows up in the agenda without your patch > - how it shows up with your patch > > so that I am better able to understand what you are trying > to achieve with this patch? Hi Carsten - Of course, my apologies. I have a set of functions that download from remote ical files, then convert to diary entries. (attached, if anybody is interested). This results in some diary entries which look like, for example: x x x x x x x x=20 1/4/2009 All day event Description of all day event 1/4/2009 14:00-15:00 meeting A pretty long meeting description x x x x x x x x=20 This creates fancy diary pages that look like: x x x x x x x x=20 Wednesday, 1 April 2009: April Fools' Day =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D All day event Description of all day event 14:00-15:00 meeting A pretty long meeting description x x x x x x x x=20 Without the patch, I get agendas that look like: x x x x x x x x=20 Wednesday 1 April 2009 Diary: 14:00-15:00 meeting Diary: April Fools' Day Diary: All day event Diary: Description of all day event Diary: A pretty Diary: long meeting description x x x x x x x x=20 As you can see, the descriptions of the events are all mixed up. With the patch, it removes any line from the fancy diary page that starts with a space, resulting in a more compact agenda: x x x x x x x x=20 Wednesday 1 April 2009 Diary: 14:00-15:00 meeting Diary: April Fools' Day Diary: All day event x x x x x x x x=20 I can then get full event descriptions by clicking on the agenda items. One problem that I noticed with this solution is that diary entries that begin with a space (Note the two spaces before =E2=80=98Do something every month=E2=80=99): x x x x x x x x=20 %%(and (diary-date 1 t t) (diary-block 1 9 2006 1 1 9999)) Do something ev= ery month x x x x x x x x=20 get displayed with a leading space in the diary display and thus get lost when transforming to an agenda. The icalendar library seems to create diary entries like this, a problem that I will have to track down. I hope that explains what I am trying to do. best, Erik Hetzner --Multipart_Wed_Apr__1_10:26:41_2009-1 Content-Type: text/plain; charset=US-ASCII ;; icalendar -> diary code (require 'icalendar) (require 'url) (defcustom egh:ical-diary-url-list '() "List of ICS urls and the diary files to convert them to. DIARY FILES WILL BE OVERWRITTEN!" :type '(repeat (cons string string))) (defun egh:remote-ics-to-diary (url diary) (let* ((ics-temp (make-temp-file "ical")) (curl-args (append (list "-o" ics-temp) (list url)))) (apply 'call-process "curl" nil nil nil curl-args) (with-temp-buffer (insert-file-contents ics-temp) (icalendar-import-buffer diary t)) (delete-file ics-temp) (save-excursion (find-file diary) (save-buffer) (kill-buffer nil)))) (defun egh:ical-import-all () (interactive) (let ((fetch-and-process-ical-url (lambda (entry) (let* ((url (car entry)) (file (expand-file-name (cdr entry))) (buff (get-file-buffer file))) (if buff (kill-buffer buff)) (if (file-exists-p file) (delete-file file)) (egh:remote-ics-to-diary url file))))) (mapc fetch-and-process-ical-url egh:ical-diary-url-list))) (add-hook 'diary-display-hook 'fancy-diary-display) (add-hook 'list-diary-entries-hook 'include-other-diary-files) (add-hook 'mark-diary-entries-hook 'mark-included-diary-files) (setq midnight-mode t) (add-hook 'midnight-hook 'egh:remote-ics-to-diary) --Multipart_Wed_Apr__1_10:26:41_2009-1-- --pgp-sign-Multipart_Wed_Apr__1_10:26:41_2009-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAknTo9EACgkQhkChe2G3k3rT4QCfaVKonB1hBUo7syhg1eRKBHoe c1IAnRLgX3EJ4rWIqblKM1q2Q/tMdWGf =go2f -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Apr__1_10:26:41_2009-1-- --===============0094636576== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0094636576==--