Re: [O] [patch] Problem with insert anniversary agenda function (was Re: org-bbdb-anniversaries gives error 'bad sexp')

2011-06-20 Thread Eric S Fraga
Carsten Dominik carsten.domi...@gmail.com writes:

[...]

 Thanks for the patch!  Indeed, there was a bug here which always forced
 one particular date style even though the code was supposed to do the
 right thing.  Thanks!

 However, instead of applying your patch, I thought that maybe I
 should put my foot where my mouth is and remove these dependencies
 altogether.

 So I have just introduced a few functions org-anniversary, org-cyclic
 and a few more which are just like their diary-* cousins, but with a
 stable (ISO) order of arguments.  Ah, I like this *much* better.
 `i a' in the agenda will now also use org-anniversary, not diary-anniversary.

 For users of org-diary-class, there is a new function org-class which works
 the same as org-diary-class, but with stable argument ordering.

 - Carsten

Carsten,

many thanks for this.  The org-anniversary, at the very least, seems to
work perfectly.  It's nice not to have to worry about date orders!

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.409.g4f3a3)



[O] [patch] Problem with insert anniversary agenda function (was Re: org-bbdb-anniversaries gives error 'bad sexp')

2011-06-16 Thread Eric S Fraga
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Carsten Dominik carsten.domi...@gmail.com writes:

 On Jun 13, 2011, at 6:15 PM, Philipp Haselwarter wrote:

 thanks, got it working now (with some fiddling).
 
 looks like `calendar-date-style' is not honored /at all/, if you don't
 use -MM-DD format (as stated in the org-bbdb.el header, admittedly),
 it just blows up in your face :)

 While I think the org-bbdb code could be made more forgiving,
 I strongly feel that calendar-date-style is an evil variable,
 especially if it is applied to input.  One should never rely on it.

 my 5c.

 - Carsten

 Although I am likely to agree with you on this, any interactions with
 Emacs's diary requires working with it.  

 This reminds me of a problem with the insert anniversary function in the
 default agenda view (i a).  This function ignores the
 calendar-date-style and inserts dates in the american style, which of
 course means that diary entries are quietly ignored if you have
 calendar-date-style set to anything other than 'american...

 Not a big deal...  I don't use anniversaries *that* often!

I've made a simple change (attached) to org-agenda.el which at least
considers the 'iso date style as well as european.  Might not be fancy
lisp code but I think it works?

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 991a94a..0d074a7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7770,11 +7770,12 @@ the resulting entry will not be shown.  When TEXT is empty, switch to
   (insert \n)
   (require 'diary-lib)
   (let ((calendar-date-display-form
-	 (if (if (boundp 'calendar-date-style)
-		 (eq calendar-date-style 'european)
-		   (with-no-warnings ;; european-calendar-style is obsolete as of version 23.1
-		 (org-bound-and-true-p european-calendar-style))) ; Emacs 22
-		 '(day   month   year)
+	 (if (boundp 'calendar-date-style)
+		 (if (eq calendar-date-style 'european)
+		 '(day   month   year)
+		   (if (eq calendar-date-style 'iso)
+		   '(year   month   day)
+		 '(month   day   year)))
 	   '(month   day   year
 
 	(insert (format (diary-anniversary %s) %s

I know I should be formatting this appropriately etc but I'm still not
very comfortable with git...  too much to do, so little time.  sorry.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.399.g01eb.dirty)


Re: [O] [patch] Problem with insert anniversary agenda function (was Re: org-bbdb-anniversaries gives error 'bad sexp')

2011-06-16 Thread Carsten Dominik

On Jun 16, 2011, at 10:04 AM, Eric S Fraga wrote:

 Eric S Fraga e.fr...@ucl.ac.uk writes:
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 
 On Jun 13, 2011, at 6:15 PM, Philipp Haselwarter wrote:
 
 thanks, got it working now (with some fiddling).
 
 looks like `calendar-date-style' is not honored /at all/, if you don't
 use -MM-DD format (as stated in the org-bbdb.el header, admittedly),
 it just blows up in your face :)
 
 While I think the org-bbdb code could be made more forgiving,
 I strongly feel that calendar-date-style is an evil variable,
 especially if it is applied to input.  One should never rely on it.
 
 my 5c.
 
 - Carsten
 
 Although I am likely to agree with you on this, any interactions with
 Emacs's diary requires working with it.  
 
 This reminds me of a problem with the insert anniversary function in the
 default agenda view (i a).  This function ignores the
 calendar-date-style and inserts dates in the american style, which of
 course means that diary entries are quietly ignored if you have
 calendar-date-style set to anything other than 'american...
 
 Not a big deal...  I don't use anniversaries *that* often!
 
 I've made a simple change (attached) to org-agenda.el which at least
 considers the 'iso date style as well as european.  Might not be fancy
 lisp code but I think it works?
 
 org-agenda-consider-iso-dates.patch
 I know I should be formatting this appropriately etc but I'm still not
 very comfortable with git...  too much to do, so little time.  sorry.

Thanks for the patch!  Indeed, there was a bug here which always forced
one particular date style even though the code was supposed to do the
right thing.  Thanks!

However, instead of applying your patch, I thought that maybe I
should put my foot where my mouth is and remove these dependencies
altogether.

So I have just introduced a few functions org-anniversary, org-cyclic
and a few more which are just like their diary-* cousins, but with a
stable (ISO) order of arguments.  Ah, I like this *much* better.
`i a' in the agenda will now also use org-anniversary, not diary-anniversary.

For users of org-diary-class, there is a new function org-class which works
the same as org-diary-class, but with stable argument ordering.

- Carsten