emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [patch] Problem with insert anniversary agenda function (was Re: org-bbdb-anniversaries gives error 'bad sexp')
Date: Thu, 16 Jun 2011 09:04:29 +0100	[thread overview]
Message-ID: <87lix242ya.fsf_-_@ucl.ac.uk> (raw)
In-Reply-To: <87zklioqm9.fsf_-_@ucl.ac.uk> (Eric S. Fraga's message of "Wed, 15 Jun 2011 20:13:02 +0100")

[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Carsten Dominik <carsten.dominik@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 YYYY-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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: have insert anniversary in agenda view allow for ISO calendar dates --]
[-- Type: text/x-patch, Size: 905 bytes --]

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"

[-- Attachment #3: Type: text/plain, Size: 268 bytes --]


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)

  reply	other threads:[~2011-06-16  8:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87wrht82iw.fsf@gmx.co.uk>
2011-05-15 16:02 ` org-bbdb-anniversaries gives error 'bad sexp' Roland Winkler
2011-05-15 16:13   ` Roland Winkler
2011-05-15 16:58   ` Matt Lundin
2011-05-15 17:35     ` Roland Winkler
2011-05-16 14:03       ` Matt Lundin
2011-05-15 18:18     ` Leo
2011-05-16 14:08       ` Matt Lundin
2011-06-12 23:36         ` Philipp Haselwarter
2011-06-13  4:40           ` Nick Dokos
2011-06-13 12:27           ` Matt Lundin
2011-06-13 16:15             ` Philipp Haselwarter
2011-06-15 14:32               ` Carsten Dominik
2011-06-15 19:13                 ` [bug] Problem with insert anniversary agenda function (was Re: org-bbdb-anniversaries gives error 'bad sexp') Eric S Fraga
2011-06-16  8:04                   ` Eric S Fraga [this message]
2011-06-16 12:41                     ` [patch] " Carsten Dominik
2011-06-20  7:41                       ` Eric S Fraga

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=87lix242ya.fsf_-_@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=carsten.dominik@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).