emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Erik Hetzner <ehetzner@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Fix for org-agenda-cleanup-fancy-diary
Date: Thu, 2 Apr 2009 09:29:46 +0200	[thread overview]
Message-ID: <94189A4C-6EFF-4D4B-A67D-0937092E809E@gmail.com> (raw)
In-Reply-To: <49d3a3ad.0e538c0a.623d.ffff9e16@mx.google.com>

Hi Erik,

I see your point.  The trouble is that it is a traditional syntax
to write things in the diary like this:

1/4/2009 some event
     8:30 another event
    10:00 meet with Sam for coffee


etc etc.

You patch will remove all those secondary lines.

I think the right solution fr your case is that I will give you
a hook in the cleanup routine, so that you can do your own
cleanup.

Or a variable, OK, we could do that too.

- Carsten

On Apr 1, 2009, at 7:26 PM, Erik Hetzner wrote:

> 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
> 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
>
> This creates fancy diary pages that look like:
>
> x x x x x x x x
> Wednesday, 1 April 2009:  April Fools' Day
> ==========================================
> 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
>
> Without the patch, I get agendas that look like:
>
> x x x x x x x x
> 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
>
> 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
> 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
>
> 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 ‘Do something
> every month’):
>
> x x x x x x x x
> %%(and (diary-date 1 t t) (diary-block 1 9 2006 1 1 9999))  Do  
> something every month
> x x x x x x x x
>
> 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
>
> ;; 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)

  reply	other threads:[~2009-04-02  7:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 20:28 Fix for org-agenda-cleanup-fancy-diary Erik Hetzner
2009-04-01 10:11 ` Manish
2009-04-01 17:32   ` Erik Hetzner
2009-04-01 11:18 ` Carsten Dominik
2009-04-01 17:26   ` Erik Hetzner
2009-04-02  7:29     ` Carsten Dominik [this message]
2009-04-02 15:31       ` Erik Hetzner
2009-04-02 16:23         ` Carsten Dominik
2009-04-02 17:19           ` Erik Hetzner

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=94189A4C-6EFF-4D4B-A67D-0937092E809E@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=ehetzner@gmail.com \
    --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).