[-- Attachment #1.1.1: Type: text/plain, Size: 446 bytes --] Hi all - Thanks for the software. I am finally sending in this patch, as I have gotten tired of patching with each release! This fixes a problem I have with diary entries displaying very long information in my schedule. I have diary entries imported from ical format which have multiple paragraphs of descriptive information. Of course, perhaps there are people who want the long display, so maybe it should be an option? best, Erik Hetzner [-- Attachment #1.1.2: Type: text/plain, Size: 547 bytes --] diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 79434bd..60805cf 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3385,7 +3385,7 @@ date. It also removes lines that contain only whitespace." (re-search-forward "\n=+$" nil t) (delete-region (point-min) (min (point-max) (1+ (match-end 0))))) (goto-char (point-min)) - (while (re-search-forward "^ +\n" nil t) + (while (re-search-forward "^ .*\n" nil t) (replace-match "")) (goto-char (point-min)) (if (re-search-forward "^Org-mode dummy\n?" nil t) [-- Attachment #1.1.3: Type: text/plain, Size: 76 bytes --] ;; Erik Hetzner, California Digital Library ;; gnupg key id: 1024D/01DB07E3 [-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ 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
On Wed, Apr 1, 2009 at 1:58 AM, Erik Hetzner <erik.hetzner@ucop.edu> wrote:
> Hi all -
>
> Thanks for the software. I am finally sending in this patch, as I have
> gotten tired of patching with each release!
In case there are patches that does not help others or you want to keep
to yourself, do check out excellent entry titled "How can I keep local
changes and still track Org mode development?" by Bernt Hansen under
section titled "Keeping current" on Worg.
--
Manish
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?
- Carsten
On Mar 31, 2009, at 10:28 PM, Erik Hetzner wrote:
> Hi all -
>
> Thanks for the software. I am finally sending in this patch, as I have
> gotten tired of patching with each release!
>
> This fixes a problem I have with diary entries displaying very long
> information in my schedule. I have diary entries imported from ical
> format which have multiple paragraphs of descriptive information.
>
> Of course, perhaps there are people who want the long display, so
> maybe it should be an option?
>
> best,
> Erik Hetzner
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 79434bd..60805cf 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -3385,7 +3385,7 @@ date. It also removes lines that contain only
> whitespace."
> (re-search-forward "\n=+$" nil t)
> (delete-region (point-min) (min (point-max) (1+ (match-end 0)))))
> (goto-char (point-min))
> - (while (re-search-forward "^ +\n" nil t)
> + (while (re-search-forward "^ .*\n" nil t)
> (replace-match ""))
> (goto-char (point-min))
> (if (re-search-forward "^Org-mode dummy\n?" nil t)
> ;; Erik Hetzner, California Digital Library
> ;; gnupg key id: 1024D/01DB07E3
> _______________________________________________
> 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
[-- Attachment #1.1.1: Type: text/plain, Size: 2320 bytes --] 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 [-- Attachment #1.1.2: Type: text/plain, Size: 1447 bytes --] ;; 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) [-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ 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
[-- Attachment #1.1.1: Type: text/plain, Size: 488 bytes --] At Wed, 1 Apr 2009 15:41:56 +0530, Manish wrote: > In case there are patches that does not help others or you want to keep > to yourself, do check out excellent entry titled "How can I keep local > changes and still track Org mode development?" by Bernt Hansen under > section titled "Keeping current" on Worg. Hi Manish - Thanks for the tip! I use my own packaging system [1] to install org-mode; but I will see if I can use this workflow. best, Erik 1. <http://launchpad.net/pases> [-- Attachment #1.1.2: Type: text/plain, Size: 76 bytes --] ;; Erik Hetzner, California Digital Library ;; gnupg key id: 1024D/01DB07E3 [-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ 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
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)
[-- Attachment #1.1: Type: text/plain, Size: 984 bytes --] At Thu, 2 Apr 2009 09:29:46 +0200, Carsten Dominik wrote: > > 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. I see. Thanks, I didn’t know that. A hook would be perfect for me. Another nice feature if possible would be to keep lines that do not match “^ +[0-9].*$” together with the first line in the fancy diary display? This would mean that diary entries: 1/4/2009 09:00 Some event Event description. Would not be mangled by sorting the agenda. I have no idea if this is possible. Thanks again! best, Erik [-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ 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
On Apr 2, 2009, at 5:31 PM, Erik Hetzner wrote: > At Thu, 2 Apr 2009 09:29:46 +0200, > Carsten Dominik wrote: >> >> 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. > > I see. Thanks, I didn’t know that. > > A hook would be perfect for me. There is now org-agenda-cleanup-fancy-diary-hook > > Another nice feature if possible would be to keep lines that do not > match “^ +[0-9].*$” together with the first line in the fancy diary > display? This would mean that diary entries: > > 1/4/2009 09:00 Some event > Event description. > > Would not be mangled by sorting the agenda. I have no idea if this is > possible. It is mangled because the first line contains a time, the second does not. Since I am assuming one event per line, the sorting according to time will separate these. You could turn off sorting by time, or use the hook to add the time to each line. - Carsten > > Thanks again! > > best, > Erik
[-- Attachment #1.1: Type: text/plain, Size: 824 bytes --] At Thu, 2 Apr 2009 18:23:08 +0200, Carsten Dominik wrote: > > There is now org-agenda-cleanup-fancy-diary-hook Thank you! > > Another nice feature if possible would be to keep lines that do not > > match “^ +[0-9].*$” together with the first line in the fancy diary > > display? This would mean that diary entries: > > > > 1/4/2009 09:00 Some event > > Event description. > > > > Would not be mangled by sorting the agenda. I have no idea if this is > > possible. > > It is mangled because the first line contains a time, the second does > not. > Since I am assuming one event per line, the sorting according to time > will separate these. > > You could turn off sorting by time, or use the hook > to add the time to each line. That sounds like a good solution. best, Erik Hetzner [-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --] [-- Attachment #2: Type: text/plain, Size: 204 bytes --] _______________________________________________ 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