unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andreas Merziger <andreas.merziger@online.de>
To: 13536@debbugs.gnu.org
Subject: bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
Date: Wed, 23 Jan 2013 22:17:57 +0100	[thread overview]
Message-ID: <874ni738fu.fsf@filista.fritz.box> (raw)

To reproduce the bug start with

emacs -Q

Contents of ~/diary are the following five lines:
23 Jan 10:00 Test-Entry 1
23 Jan 10pm Test-Entry 2
23 Jan 10am Test-Entry 3
23 Jan 10Pm Test-Entry 4
23 Jan 10Am Test-Entry 5

1.) Start the calendar:

M-x calendar

2.) Set calendar-date-style to 'european

M-x calendar-set-date-style

Choose 'european.

3.) In *Calendar* - buffer go to date:

 January, 23 of year 10

4.) Type key `d' to show the diary for that date

UNEXPECTEDLY, the buffer `Fancy Diary Entries' looks like this:

Saturday, 23 January 10
=======================
10:00 Test-Entry 1
10pm Test-Entry 2
10am Test-Entry 3
10Pm Test-Entry 4
10Am Test-Entry 5
00 Test-Entry 1
m Test-Entry 2
m Test-Entry 3
m Test-Entry 4
m Test-Entry 5


The first five line are the expected ones - the last five lines appear due to the
fact, that the elements of the list `diary-european-date-forms' are NOT
mutually exclusive, as they should as required by the documentation.

--- End of Bug description ---

SUGGESTED FIX:

In File PATH-TO-EMACS/lisp/calendar/calendar.el 
do the following:

(defcustom diary-european-date-forms
  '((day "/" month "[^/0-9]")
    (day "/" month "/" year "[^0-9]")
    (backup day " *" monthname"\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
;;--------------------------------------------------------------
;; (day " *" monthname " *" year "[^0-9]")  (not restrictive enough)
   (day " *" monthname " *" year "[^0-9:aApP]") ;; (suggested fix)
;;--------------------------------------^^^^^------------------- 
;; Include letters a,A,p,P and colon here
;;
    (dayname "\\W"))
  "List of pseudo-patterns describing the European style of dates.
The defaults are: DAY/MONTH; DAY/MONTH/YEAR; DAY MONTHNAME;
DAY MONTHNAME YEAR; DAYNAME.  Normally you should not customize this, but
`diary-date-forms' (which see)."
  :type '(repeat (choice (cons :tag "Backup"
                               :value (backup . nil)
                               (const backup)
                               (repeat (list :inline t :format "%v"
                                             (symbol :tag "Keyword")
                                             (choice symbol regexp))))
                         (repeat (list :inline t :format "%v"
                                       (symbol :tag "Keyword")
                                       (choice symbol regexp)))))
  :group 'diary)

After this change I could not observe this unexpected behaviour anymore.

COMMENT:
This misbehaviour is not just a matter of sophistry.
I'm trying to develop a contribution to emacs calendar/diary
which allows a form of natural (automated) archiving of outdatet diary entries, this
way trying to avoid that the diary file grows unnecessarily large over
time. (Any hints, ideas, minimal requirements on this welcome :-))

Matching of diary entries is much harder, if these date-forms are NOT
mutually exclusive.

So please consider fixing that the suggested (or any other) way.

Thanks in advance!








             reply	other threads:[~2013-01-23 21:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 21:17 Andreas Merziger [this message]
2019-08-15  7:30 ` bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix Lars Ingebrigtsen
2019-08-16  1:04   ` Lars Ingebrigtsen
2019-08-16  1:31   ` Glenn Morris
2019-08-16  1:40     ` Lars Ingebrigtsen

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ni738fu.fsf@filista.fritz.box \
    --to=andreas.merziger@online.de \
    --cc=13536@debbugs.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.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).