emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to add entries to an org file, not diary
@ 2009-11-06 15:16 Stephen Eglen
  2009-11-06 17:02 ` Matt Lundin
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Stephen Eglen @ 2009-11-06 15:16 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Stephen Eglen

Dear all,
If I'm visting an agenda (C-c a a) buffer, and want to add a diary entry
for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
This inserts an entry in my diary file.  

What I'd like to do is add the entry instead to an org file,
e.g. 'agenda.org' where I currently store all diary-like entries.  Is
that functionality available?  (Am trying to wean myself off diary
files, after many years of using it...)

Thanks, Stephen

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

* Re: How to add entries to an org file, not diary
  2009-11-06 15:16 How to add entries to an org file, not diary Stephen Eglen
@ 2009-11-06 17:02 ` Matt Lundin
  2009-11-07  7:04   ` Carsten Dominik
  2009-11-06 17:21 ` Bernt Hansen
  2009-11-09 21:09 ` Carsten Dominik
  2 siblings, 1 reply; 13+ messages in thread
From: Matt Lundin @ 2009-11-06 17:02 UTC (permalink / raw)
  To: Stephen Eglen; +Cc: emacs-orgmode

Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:

> Dear all,
> If I'm visting an agenda (C-c a a) buffer, and want to add a diary entry
> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
> This inserts an entry in my diary file.  
>
> What I'd like to do is add the entry instead to an org file,
> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
> that functionality available?  (Am trying to wean myself off diary
> files, after many years of using it...)

I use "k r" to call a remember buffer from a particular date in the
agenda. I also have a special remember template for appointments:

(?a "* %^{Appt}\n %t%?" nil bottom nil)

This results in an item with a timestamp that corresponds to the date
the cursor was on in the agenda.

Best,
Matt

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

* Re: How to add entries to an org file, not diary
  2009-11-06 15:16 How to add entries to an org file, not diary Stephen Eglen
  2009-11-06 17:02 ` Matt Lundin
@ 2009-11-06 17:21 ` Bernt Hansen
  2009-11-07  7:02   ` Carsten Dominik
  2009-11-09 21:09 ` Carsten Dominik
  2 siblings, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2009-11-06 17:21 UTC (permalink / raw)
  To: Stephen Eglen; +Cc: emacs-orgmode

Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:

> Dear all,
> If I'm visting an agenda (C-c a a) buffer, and want to add a diary entry
> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
> This inserts an entry in my diary file.  
>
> What I'd like to do is add the entry instead to an org file,
> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
> that functionality available?  (Am trying to wean myself off diary
> files, after many years of using it...)
>
> Thanks, Stephen

Hi Stephen,

I agree that would be a nice feature.  I stopped using the diary a few
years ago and have totally avoided the 'i' functions in the agenda since
it creates diary entries that just get lost for me.  Instead I've
trained by fingers to make remember tasks instead but I have to create
the dates manually in the remember task.

It would be a lot nicer if this could create a task with a diary sexp
type entry for the details.

I don't believe this functionality exists today.

Regards,
Bernt

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

* Re: Re: How to add entries to an org file, not diary
  2009-11-06 17:21 ` Bernt Hansen
@ 2009-11-07  7:02   ` Carsten Dominik
  2009-11-07 18:28     ` Bernt Hansen
  0 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2009-11-07  7:02 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Stephen Eglen


On Nov 6, 2009, at 6:21 PM, Bernt Hansen wrote:

> Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>
>> Dear all,
>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary  
>> entry
>> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
>> This inserts an entry in my diary file.
>>
>> What I'd like to do is add the entry instead to an org file,
>> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
>> that functionality available?  (Am trying to wean myself off diary
>> files, after many years of using it...)
>>
>> Thanks, Stephen
>
> Hi Stephen,
>
> I agree that would be a nice feature.  I stopped using the diary a few
> years ago and have totally avoided the 'i' functions in the agenda  
> since
> it creates diary entries that just get lost for me.  Instead I've
> trained by fingers to make remember tasks instead but I have to create
> the dates manually in the remember task.
>
> It would be a lot nicer if this could create a task with a diary sexp
> type entry for the details.

Why diary sexp entries and not direct Org time stamp
entries?  Is there a consensus that diary sexps should
be use for this application?

- Carsten

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

* Re: Re: How to add entries to an org file, not diary
  2009-11-06 17:02 ` Matt Lundin
@ 2009-11-07  7:04   ` Carsten Dominik
  0 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-11-07  7:04 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode, Stephen Eglen


On Nov 6, 2009, at 6:02 PM, Matt Lundin wrote:

> Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>
>> Dear all,
>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary  
>> entry
>> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
>> This inserts an entry in my diary file.
>>
>> What I'd like to do is add the entry instead to an org file,
>> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
>> that functionality available?  (Am trying to wean myself off diary
>> files, after many years of using it...)
>
> I use "k r" to call a remember buffer from a particular date in the
> agenda. I also have a special remember template for appointments:
>
> (?a "* %^{Appt}\n %t%?" nil bottom nil)
>
> This results in an item with a timestamp that corresponds to the date
> the cursor was on in the agenda.

Cool, I had forgotten this. :-)

- Carsten

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

* Re: Re: How to add entries to an org file, not diary
  2009-11-07  7:02   ` Carsten Dominik
@ 2009-11-07 18:28     ` Bernt Hansen
  0 siblings, 0 replies; 13+ messages in thread
From: Bernt Hansen @ 2009-11-07 18:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Stephen Eglen

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Nov 6, 2009, at 6:21 PM, Bernt Hansen wrote:
>
>> Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:
>>
>>> Dear all,
>>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary
>>> entry
>>> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
>>> This inserts an entry in my diary file.
>>>
>>> What I'd like to do is add the entry instead to an org file,
>>> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
>>> that functionality available?  (Am trying to wean myself off diary
>>> files, after many years of using it...)
>>>
>>> Thanks, Stephen
>>
>> Hi Stephen,
>>
>> I agree that would be a nice feature.  I stopped using the diary a few
>> years ago and have totally avoided the 'i' functions in the agenda
>> since
>> it creates diary entries that just get lost for me.  Instead I've
>> trained by fingers to make remember tasks instead but I have to create
>> the dates manually in the remember task.
>>
>> It would be a lot nicer if this could create a task with a diary sexp
>> type entry for the details.
>
> Why diary sexp entries and not direct Org time stamp
> entries?  Is there a consensus that diary sexps should
> be use for this application?

Actually the diary sexp isn't really important.  I used to make block
entries spanning multiple days with the old diary entries and was just
thinking that diary sexp entries are needed to do that - but for single
dates and times org timestamp entries are fine.

-Bernt

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

* Re: How to add entries to an org file, not diary
  2009-11-06 15:16 How to add entries to an org file, not diary Stephen Eglen
  2009-11-06 17:02 ` Matt Lundin
  2009-11-06 17:21 ` Bernt Hansen
@ 2009-11-09 21:09 ` Carsten Dominik
  2009-11-09 21:39   ` Bernt Hansen
  2009-11-10  1:57   ` Darlan Cavalcante Moreira
  2 siblings, 2 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-11-09 21:09 UTC (permalink / raw)
  To: Stephen Eglen; +Cc: Bernt Hansen, Matt Lundin, Org Mode

Hi Stephen,

On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:

> Dear all,
> If I'm visting an agenda (C-c a a) buffer, and want to add a diary  
> entry
> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
> This inserts an entry in my diary file.
>
> What I'd like to do is add the entry instead to an org file,
> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
> that functionality available?  (Am trying to wean myself off diary
> files, after many years of using it...)

If you get the latest Org version from the git server, you can
configure the variable `org-agenda-diary-file' to point to your
"diary.org" file or any other Org-mode file.  This should be a
file dedicated for general appointments, anniversaries
etc.

Then `i' in the agenda will create new entries in that file.
Simple entries (day and block) will be placed into an outline
tree that is based on dates:  Top-level years, level 2 months,
level 3 days[1].  I have always wanted to have something
like this, so that it will be easy to archive old stuff!  So thanks
for giving me a reason to finally make it.

Right now I have implemented

i d   for day entries,
i b   for blocks,
i a   for anniversaries (which will be collected under a special
       heading "Anniversaries" in your `diary.org'
i j   To jump to the cursor date in the date tree

What else would be useful?

The same command will also be bound to the `i' key in the
calendar (calendar restart required), so you can make the same
kind of entries from the calendar - very convenient at times,
in particular for long blocks.

The basics of these new commands seem to work OK, but it
is quite possible that I have not yet thought this through
fully.  Let me know what I am missing, so that we can tweak it.

- Carsten

[1] If there is any entry in this file with a DATE_TREE property set,
the tree will be build under that entry.

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

* Re: How to add entries to an org file, not diary
  2009-11-09 21:09 ` Carsten Dominik
@ 2009-11-09 21:39   ` Bernt Hansen
  2009-11-09 21:45     ` Carsten Dominik
  2009-11-10  1:57   ` Darlan Cavalcante Moreira
  1 sibling, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2009-11-09 21:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode, Matt Lundin, Stephen Eglen

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Stephen,
>
> On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:
>
>> Dear all,
>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary
>> entry
>> for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
>> This inserts an entry in my diary file.
>>
>> What I'd like to do is add the entry instead to an org file,
>> e.g. 'agenda.org' where I currently store all diary-like entries.  Is
>> that functionality available?  (Am trying to wean myself off diary
>> files, after many years of using it...)
>
> If you get the latest Org version from the git server, you can
> configure the variable `org-agenda-diary-file' to point to your
> "diary.org" file or any other Org-mode file.  This should be a
> file dedicated for general appointments, anniversaries
> etc.
>
> Then `i' in the agenda will create new entries in that file.
> Simple entries (day and block) will be placed into an outline
> tree that is based on dates:  Top-level years, level 2 months,
> level 3 days[1].  I have always wanted to have something
> like this, so that it will be easy to archive old stuff!  So thanks
> for giving me a reason to finally make it.
>
> Right now I have implemented
>
> i d   for day entries,
> i b   for blocks,
> i a   for anniversaries (which will be collected under a special
>       heading "Anniversaries" in your `diary.org'
> i j   To jump to the cursor date in the date tree
>
> What else would be useful?
>
> The same command will also be bound to the `i' key in the
> calendar (calendar restart required), so you can make the same
> kind of entries from the calendar - very convenient at times,
> in particular for long blocks.
>
> The basics of these new commands seem to work OK, but it
> is quite possible that I have not yet thought this through
> fully.  Let me know what I am missing, so that we can tweak it.

This is really cool! :)  Thanks for implementing the block dates!

I just tried it with anniversaries and get the following error

GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of 2008-11-09
on raven, modified by Debian
Org-mode version 6.32trans (release_6.32b.142.g01b1)

My version of org-mode has the clocking commit reverted

Debugger entered--Lisp error: (void-function diary-date-display-form)
  (diary-date-display-form)
  (let ((calendar-date-display-form ...)) (insert (format "%%%%(diary-anniversary %s) %s" ... text)))
  (cond ((eq type ...) (or ... ...) (outline-next-heading) (org-back-over-empty-lines) (backward-char 1) (insert "\n") (let ... ...)) ((eq type ...) (require ...) (org-datetree-find-date-create d1) (org-agenda-insert-diary-make-new-entry text) (org-insert-time-stamp ...) (end-of-line 0)) ((eq type ...) (if ... ...) (require ...) (org-datetree-find-date-create d1) (org-agenda-insert-diary-make-new-entry text) (org-insert-time-stamp ...) (insert "--") (org-insert-time-stamp ...) (end-of-line 0)))
  (let ((cw ...)) (org-switch-to-buffer-other-window (find-file-noselect org-agenda-diary-file)) (widen) (goto-char (point-min)) (cond (... ... ... ... ... ... ...) (... ... ... ... ... ...) (... ... ... ... ... ... ... ... ...)) (if (string-match "\\S-" text) (progn ... ...) (message "Please finish entry here")))
  org-agenda-add-entry-to-org-agenda-diary-file(anniversary "foobar" (10 13 2009))
  (cond ((equal char 100) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1)) ((equal char 97) (setq d1 ...) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1)) ((equal char 98) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1 d2)) ((equal char 106) (org-switch-to-buffer-other-window ...) (org-datetree-find-date-create d1) (org-reveal t)) (t (error "Invalid selection character `%c'" char)))
  (let (d1 d2 char (text "")) (if (equal ... "*Calendar*") (setq d1 ... d2 ...) (setq d1 ... d2 ...)) (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") (setq char (read-char-exclusive)) (cond (... ... ...) (... ... ... ...) (... ... ...) (... ... ... ...) (t ...)))
  org-agenda-diary-entry-in-org-file()
  (if (not (eq org-agenda-diary-file ...)) (org-agenda-diary-entry-in-org-file) (require (quote diary-lib)) (let* (... ... ... ... ...) (unless cmd ...) (unless ... ...) (let ... ...)))
  org-agenda-diary-entry()
  call-interactively(org-agenda-diary-entry)

-Bernt

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

* Re: How to add entries to an org file, not diary
  2009-11-09 21:39   ` Bernt Hansen
@ 2009-11-09 21:45     ` Carsten Dominik
  0 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-11-09 21:45 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Org Mode, Matt Lundin, Stephen Eglen

Fixed, thanks

- Carsten

On Nov 9, 2009, at 10:39 PM, Bernt Hansen wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Hi Stephen,
>>
>> On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:
>>
>>> Dear all,
>>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary
>>> entry
>>> for a particular day, I can use org-agenda-diary-entry, bound to  
>>> 'i'.
>>> This inserts an entry in my diary file.
>>>
>>> What I'd like to do is add the entry instead to an org file,
>>> e.g. 'agenda.org' where I currently store all diary-like entries.   
>>> Is
>>> that functionality available?  (Am trying to wean myself off diary
>>> files, after many years of using it...)
>>
>> If you get the latest Org version from the git server, you can
>> configure the variable `org-agenda-diary-file' to point to your
>> "diary.org" file or any other Org-mode file.  This should be a
>> file dedicated for general appointments, anniversaries
>> etc.
>>
>> Then `i' in the agenda will create new entries in that file.
>> Simple entries (day and block) will be placed into an outline
>> tree that is based on dates:  Top-level years, level 2 months,
>> level 3 days[1].  I have always wanted to have something
>> like this, so that it will be easy to archive old stuff!  So thanks
>> for giving me a reason to finally make it.
>>
>> Right now I have implemented
>>
>> i d   for day entries,
>> i b   for blocks,
>> i a   for anniversaries (which will be collected under a special
>>      heading "Anniversaries" in your `diary.org'
>> i j   To jump to the cursor date in the date tree
>>
>> What else would be useful?
>>
>> The same command will also be bound to the `i' key in the
>> calendar (calendar restart required), so you can make the same
>> kind of entries from the calendar - very convenient at times,
>> in particular for long blocks.
>>
>> The basics of these new commands seem to work OK, but it
>> is quite possible that I have not yet thought this through
>> fully.  Let me know what I am missing, so that we can tweak it.
>
> This is really cool! :)  Thanks for implementing the block dates!
>
> I just tried it with anniversaries and get the following error
>
> GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of  
> 2008-11-09
> on raven, modified by Debian
> Org-mode version 6.32trans (release_6.32b.142.g01b1)
>
> My version of org-mode has the clocking commit reverted
>
> Debugger entered--Lisp error: (void-function diary-date-display-form)
>  (diary-date-display-form)
>  (let ((calendar-date-display-form ...)) (insert (format "%%%%(diary- 
> anniversary %s) %s" ... text)))
>  (cond ((eq type ...) (or ... ...) (outline-next-heading) (org-back- 
> over-empty-lines) (backward-char 1) (insert "\n") (let ... ...))  
> ((eq type ...) (require ...) (org-datetree-find-date-create d1) (org- 
> agenda-insert-diary-make-new-entry text) (org-insert-time-stamp ...)  
> (end-of-line 0)) ((eq type ...) (if ... ...) (require ...) (org- 
> datetree-find-date-create d1) (org-agenda-insert-diary-make-new- 
> entry text) (org-insert-time-stamp ...) (insert "--") (org-insert- 
> time-stamp ...) (end-of-line 0)))
>  (let ((cw ...)) (org-switch-to-buffer-other-window (find-file- 
> noselect org-agenda-diary-file)) (widen) (goto-char (point-min))  
> (cond (... ... ... ... ... ... ...) (... ... ... ... ... ...)  
> (... ... ... ... ... ... ... ... ...)) (if (string-match "\\S-"  
> text) (progn ... ...) (message "Please finish entry here")))
>  org-agenda-add-entry-to-org-agenda-diary-file(anniversary  
> "foobar" (10 13 2009))
>  (cond ((equal char 100) (setq text ...) (org-agenda-add-entry-to- 
> org-agenda-diary-file ... text d1)) ((equal char 97) (setq d1 ...)  
> (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ...  
> text d1)) ((equal char 98) (setq text ...) (org-agenda-add-entry-to- 
> org-agenda-diary-file ... text d1 d2)) ((equal char 106) (org-switch- 
> to-buffer-other-window ...) (org-datetree-find-date-create d1) (org- 
> reveal t)) (t (error "Invalid selection character `%c'" char)))
>  (let (d1 d2 char (text "")) (if (equal ... "*Calendar*") (setq  
> d1 ... d2 ...) (setq d1 ... d2 ...)) (message "Diary entry: [d]ay  
> [a]nniversary [b]lock [j]ump to date tree") (setq char (read-char- 
> exclusive)) (cond (... ... ...) (... ... ... ...) (... ... ...)  
> (... ... ... ...) (t ...)))
>  org-agenda-diary-entry-in-org-file()
>  (if (not (eq org-agenda-diary-file ...)) (org-agenda-diary-entry-in- 
> org-file) (require (quote diary-lib)) (let* (... ... ... ... ...)  
> (unless cmd ...) (unless ... ...) (let ... ...)))
>  org-agenda-diary-entry()
>  call-interactively(org-agenda-diary-entry)
>
> -Bernt

- Carsten

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

* Re: How to add entries to an org file, not diary
  2009-11-09 21:09 ` Carsten Dominik
  2009-11-09 21:39   ` Bernt Hansen
@ 2009-11-10  1:57   ` Darlan Cavalcante Moreira
  2009-11-10  5:51     ` Alan E. Davis
  2009-11-10  7:23     ` Carsten Dominik
  1 sibling, 2 replies; 13+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-11-10  1:57 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, Matt Lundin, Stephen Eglen, Org Mode


This is really nice.
Thanks Carsten!

I currently use a subtree in my main org file to put dates for
appointments, birthdays, etc.. Having a native way to do that will
save time and I my approach could became to cluttered in the future.

I only miss an easy way to change the date of an appointment, for
example. The usual refiling is not very efficient here, since the
diary file will have a lot of headings and one may need to refile it
to a heading that doesn't exist yet. Maybe org-refile could test if
this is the diary file and if it is, offer an interface similar to the
usual time stamp insertion.

But this is something minor.
Again, thanks for this and org-mode.


At Mon, 9 Nov 2009 22:09:23 +0100,
Carsten Dominik <carsten.dominik@gmail.com> wrote:
> 
> Hi Stephen,
> 
> On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:
> 
> > Dear all,
> > If I'm visting an agenda (C-c a a) buffer, and want to add a diary  
> > entry
> > for a particular day, I can use org-agenda-diary-entry, bound to 'i'.
> > This inserts an entry in my diary file.
> >
> > What I'd like to do is add the entry instead to an org file,
> > e.g. 'agenda.org' where I currently store all diary-like entries.  Is
> > that functionality available?  (Am trying to wean myself off diary
> > files, after many years of using it...)
> 
> If you get the latest Org version from the git server, you can
> configure the variable `org-agenda-diary-file' to point to your
> "diary.org" file or any other Org-mode file.  This should be a
> file dedicated for general appointments, anniversaries
> etc.
> 
> Then `i' in the agenda will create new entries in that file.
> Simple entries (day and block) will be placed into an outline
> tree that is based on dates:  Top-level years, level 2 months,
> level 3 days[1].  I have always wanted to have something
> like this, so that it will be easy to archive old stuff!  So thanks
> for giving me a reason to finally make it.
> 
> Right now I have implemented
> 
> i d   for day entries,
> i b   for blocks,
> i a   for anniversaries (which will be collected under a special
>        heading "Anniversaries" in your `diary.org'
> i j   To jump to the cursor date in the date tree
> 
> What else would be useful?
> 
> The same command will also be bound to the `i' key in the
> calendar (calendar restart required), so you can make the same
> kind of entries from the calendar - very convenient at times,
> in particular for long blocks.
> 
> The basics of these new commands seem to work OK, but it
> is quite possible that I have not yet thought this through
> fully.  Let me know what I am missing, so that we can tweak it.
> 
> - Carsten
> 
> [1] If there is any entry in this file with a DATE_TREE property set,
> the tree will be build under that entry.
> 
> 
> _______________________________________________
> 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

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

* Re: How to add entries to an org file, not diary
  2009-11-10  1:57   ` Darlan Cavalcante Moreira
@ 2009-11-10  5:51     ` Alan E. Davis
  2009-11-10  7:23     ` Carsten Dominik
  1 sibling, 0 replies; 13+ messages in thread
From: Alan E. Davis @ 2009-11-10  5:51 UTC (permalink / raw)
  To: Org Mode; +Cc: Bernt Hansen, Matt Lundin, Stephen Eglen, Carsten Dominik


[-- Attachment #1.1: Type: text/plain, Size: 3625 bytes --]

>
> At Mon, 9 Nov 2009 22:09:23 +0100,
> Carsten Dominik <carsten.dominik@gmail.com> wrote:
>
> > Right now I have implemented
> >
> > i d   for day entries,
> > i b   for blocks,
> > i a   for anniversaries (which will be collected under a special
> >        heading "Anniversaries" in your `diary.org'
> > i j   To jump to the cursor date in the date tree
> >
> > What else would be useful?
>

Thank you for this:

I don't remember how this came to pass.  I think after writing email to Ed
Reingold, author of the various emacs calendar tools, and eventually, this
came about.  I've thought ever since, that it needed polishing, but I used
it innumerable times over the years.  Perhaps this would be useful for what
you are implementing, or something like it.  I'd like to have it.  This was
certainly  done up by Ed Reingold originally, but I've lost track (it was in
the pre-org-mode time).

The polishing part comes from the inconvenience of typing individually the
numbers of days ahead of time one wanted to be reminded.  I don't know how
to make it better.  Maybe org-agenda already does this pretty well.  Out of
laziness, I used to type something like this, for numbers of days to remind:
"30 27 25 22 20 17 14 12 9 7 5 4 3 2 1".  Possibly a hard-coded sequence
would be just as good, and it could skip weekends, or other inconvenient
days, be sure to hit fridays, or whatever.

Possibly this is all redundant in the context of org-mode.  I guess it is,
but I'll send it along anyway.

Anyway, here it is.  I have it bound to "i e" in the calendar map.


;;;;;;;;;;;;;;;Begin
"diary-insert-event-with-reminder";;;;;;;;;;;;;;;;;;;;;;;8<;;;;;;;;;;;;;;
;; Trivially, this function is covered by the GPL.  It "borrows liberally"
(TM)
;; from the diary-lib package of Ed Reingold.
;; Alan Davis   15 May 1998.  Saipan, NMI.
;;
;; When  invoked,  this function prompts for  a string of numbers
;; representing the number of days in advance you would like to be
;; reminded.  Enter a sequence of numbers, like '1 2 3 4 7 8 20'.
;; Subsequently, the function will query for a description of the event.
;; You may optionally type a description of the event; whether or not
;; you do not do so, after you type <ENTER>,  will find yourself in
;; your .diary file at the newly inserted line.
;;
;; You may wish to place the following line in your .emacs:
;;  (require 'diary-insert-event-with-reminder)

(defun diary-insert-event-with-reminder (daylist event arg)
  "Insert a unique event, on a single date as given by point.  A
prefix arg will make the entry nonmarking.  When invoked, this
function will interactively ask for the number of days in advance that
you'd like to be reminded, and a name for the event."
  (interactive "sDays in advance to remind: \nsWhat's the event? \nP")
  (require 'diary-lib)
  (let* ((calendar-date-display-form
      (if european-calendar-style
          '(day " " month " " year)
        '(month " " day " " year))))
    (make-diary-entry
     (format "%s(diary-remind '(diary-date %s) '(%s)) %s"
         sexp-diary-entry-symbol
         (calendar-date-string (calendar-cursor-to-date t) nil t) daylist
event)
     arg)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;END;;;;;;;;;;;;;;;;>8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

To bind to keys "ie" in calendar-mode-map:

(setq calendar-load-hook
     '(lambda ()
        ;; Keybinding
        (define-key calendar-mode-map
          "ie"
          'diary-insert-event-with-reminder)
))
;;;;;;;;;;;;;;;

I haven't gotten my feet wet with this new implementation, but will be doing
so,  I'm not sure how this would fit in with what you have implemented.

Alan Davis

[-- Attachment #1.2: Type: text/html, Size: 4492 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

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

* Re: How to add entries to an org file, not diary
  2009-11-10  1:57   ` Darlan Cavalcante Moreira
  2009-11-10  5:51     ` Alan E. Davis
@ 2009-11-10  7:23     ` Carsten Dominik
  2009-11-10 14:28       ` Darlan Cavalcante Moreira
  1 sibling, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2009-11-10  7:23 UTC (permalink / raw)
  To: Darlan Cavalcante Moreira
  Cc: Bernt Hansen, Matt Lundin, Stephen Eglen, Org Mode


On Nov 10, 2009, at 2:57 AM, Darlan Cavalcante Moreira wrote:

>
> This is really nice.
> Thanks Carsten!
>
> I currently use a subtree in my main org file to put dates for
> appointments, birthdays, etc.. Having a native way to do that will
> save time and I my approach could became to cluttered in the future.
>
> I only miss an easy way to change the date of an appointment, for
> example. The usual refiling is not very efficient here, since the
> diary file will have a lot of headings and one may need to refile it
> to a heading that doesn't exist yet. Maybe org-refile could test if
> this is the diary file and if it is, offer an interface similar to the
> usual time stamp insertion.

Hi Darlan,

the simple answer is:  Don't be religious about where
in the date three the entry is located.  Placing all these
entries into a tree is a convenience, but it has no significance
for the interpretation of the entries when the agenda is constructed.
Each entry still contains a time stamp, and changing the appointment
rescheduling means that this time stamp is changed.
The entry will still be located under the day where it initially
belonged, but so what?

The longer answer would be to write a function that cleans up
the tree and moves all entries to the right date.  Not too hard
to write.  In fact, I have just added it:

M-x org-datetree-cleanup RET

If your date tree is part of a larger buffer,
you might want to narrow the buffer to the date tree
before running this command.

- Carsten

>
> But this is something minor.
> Again, thanks for this and org-mode.
>
>
> At Mon, 9 Nov 2009 22:09:23 +0100,
> Carsten Dominik <carsten.dominik@gmail.com> wrote:
>>
>> Hi Stephen,
>>
>> On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:
>>
>>> Dear all,
>>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary
>>> entry
>>> for a particular day, I can use org-agenda-diary-entry, bound to  
>>> 'i'.
>>> This inserts an entry in my diary file.
>>>
>>> What I'd like to do is add the entry instead to an org file,
>>> e.g. 'agenda.org' where I currently store all diary-like entries.   
>>> Is
>>> that functionality available?  (Am trying to wean myself off diary
>>> files, after many years of using it...)
>>
>> If you get the latest Org version from the git server, you can
>> configure the variable `org-agenda-diary-file' to point to your
>> "diary.org" file or any other Org-mode file.  This should be a
>> file dedicated for general appointments, anniversaries
>> etc.
>>
>> Then `i' in the agenda will create new entries in that file.
>> Simple entries (day and block) will be placed into an outline
>> tree that is based on dates:  Top-level years, level 2 months,
>> level 3 days[1].  I have always wanted to have something
>> like this, so that it will be easy to archive old stuff!  So thanks
>> for giving me a reason to finally make it.
>>
>> Right now I have implemented
>>
>> i d   for day entries,
>> i b   for blocks,
>> i a   for anniversaries (which will be collected under a special
>>       heading "Anniversaries" in your `diary.org'
>> i j   To jump to the cursor date in the date tree
>>
>> What else would be useful?
>>
>> The same command will also be bound to the `i' key in the
>> calendar (calendar restart required), so you can make the same
>> kind of entries from the calendar - very convenient at times,
>> in particular for long blocks.
>>
>> The basics of these new commands seem to work OK, but it
>> is quite possible that I have not yet thought this through
>> fully.  Let me know what I am missing, so that we can tweak it.
>>
>> - Carsten
>>
>> [1] If there is any entry in this file with a DATE_TREE property set,
>> the tree will be build under that entry.
>>
>>
>> _______________________________________________
>> 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

- Carsten

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

* Re: How to add entries to an org file, not diary
  2009-11-10  7:23     ` Carsten Dominik
@ 2009-11-10 14:28       ` Darlan Cavalcante Moreira
  0 siblings, 0 replies; 13+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-11-10 14:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, Matt Lundin, Stephen Eglen, Org Mode


Perfect, thanks!

- Darlan
At Tue, 10 Nov 2009 08:23:50 +0100,
Carsten Dominik <carsten.dominik@gmail.com> wrote:
> 
> 
> On Nov 10, 2009, at 2:57 AM, Darlan Cavalcante Moreira wrote:
> 
> >
> > This is really nice.
> > Thanks Carsten!
> >
> > I currently use a subtree in my main org file to put dates for
> > appointments, birthdays, etc.. Having a native way to do that will
> > save time and I my approach could became to cluttered in the future.
> >
> > I only miss an easy way to change the date of an appointment, for
> > example. The usual refiling is not very efficient here, since the
> > diary file will have a lot of headings and one may need to refile it
> > to a heading that doesn't exist yet. Maybe org-refile could test if
> > this is the diary file and if it is, offer an interface similar to the
> > usual time stamp insertion.
> 
> Hi Darlan,
> 
> the simple answer is:  Don't be religious about where
> in the date three the entry is located.  Placing all these
> entries into a tree is a convenience, but it has no significance
> for the interpretation of the entries when the agenda is constructed.
> Each entry still contains a time stamp, and changing the appointment
> rescheduling means that this time stamp is changed.
> The entry will still be located under the day where it initially
> belonged, but so what?
> 
> The longer answer would be to write a function that cleans up
> the tree and moves all entries to the right date.  Not too hard
> to write.  In fact, I have just added it:
> 
> M-x org-datetree-cleanup RET
> 
> If your date tree is part of a larger buffer,
> you might want to narrow the buffer to the date tree
> before running this command.
> 
> - Carsten
> 
> >
> > But this is something minor.
> > Again, thanks for this and org-mode.
> >
> >
> > At Mon, 9 Nov 2009 22:09:23 +0100,
> > Carsten Dominik <carsten.dominik@gmail.com> wrote:
> >>
> >> Hi Stephen,
> >>
> >> On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote:
> >>
> >>> Dear all,
> >>> If I'm visting an agenda (C-c a a) buffer, and want to add a diary
> >>> entry
> >>> for a particular day, I can use org-agenda-diary-entry, bound to  
> >>> 'i'.
> >>> This inserts an entry in my diary file.
> >>>
> >>> What I'd like to do is add the entry instead to an org file,
> >>> e.g. 'agenda.org' where I currently store all diary-like entries.   
> >>> Is
> >>> that functionality available?  (Am trying to wean myself off diary
> >>> files, after many years of using it...)
> >>
> >> If you get the latest Org version from the git server, you can
> >> configure the variable `org-agenda-diary-file' to point to your
> >> "diary.org" file or any other Org-mode file.  This should be a
> >> file dedicated for general appointments, anniversaries
> >> etc.
> >>
> >> Then `i' in the agenda will create new entries in that file.
> >> Simple entries (day and block) will be placed into an outline
> >> tree that is based on dates:  Top-level years, level 2 months,
> >> level 3 days[1].  I have always wanted to have something
> >> like this, so that it will be easy to archive old stuff!  So thanks
> >> for giving me a reason to finally make it.
> >>
> >> Right now I have implemented
> >>
> >> i d   for day entries,
> >> i b   for blocks,
> >> i a   for anniversaries (which will be collected under a special
> >>       heading "Anniversaries" in your `diary.org'
> >> i j   To jump to the cursor date in the date tree
> >>
> >> What else would be useful?
> >>
> >> The same command will also be bound to the `i' key in the
> >> calendar (calendar restart required), so you can make the same
> >> kind of entries from the calendar - very convenient at times,
> >> in particular for long blocks.
> >>
> >> The basics of these new commands seem to work OK, but it
> >> is quite possible that I have not yet thought this through
> >> fully.  Let me know what I am missing, so that we can tweak it.
> >>
> >> - Carsten
> >>
> >> [1] If there is any entry in this file with a DATE_TREE property set,
> >> the tree will be build under that entry.
> >>
> >>
> >> _______________________________________________
> >> 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
> 
> - Carsten
> 
> 
> 

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

end of thread, other threads:[~2009-11-10 14:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-06 15:16 How to add entries to an org file, not diary Stephen Eglen
2009-11-06 17:02 ` Matt Lundin
2009-11-07  7:04   ` Carsten Dominik
2009-11-06 17:21 ` Bernt Hansen
2009-11-07  7:02   ` Carsten Dominik
2009-11-07 18:28     ` Bernt Hansen
2009-11-09 21:09 ` Carsten Dominik
2009-11-09 21:39   ` Bernt Hansen
2009-11-09 21:45     ` Carsten Dominik
2009-11-10  1:57   ` Darlan Cavalcante Moreira
2009-11-10  5:51     ` Alan E. Davis
2009-11-10  7:23     ` Carsten Dominik
2009-11-10 14:28       ` Darlan Cavalcante Moreira

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