unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
@ 2013-01-23 21:17 Andreas Merziger
  2019-08-15  7:30 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Merziger @ 2013-01-23 21:17 UTC (permalink / raw)
  To: 13536

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!








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

end of thread, other threads:[~2019-08-16  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 21:17 bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix Andreas Merziger
2019-08-15  7:30 ` Lars Ingebrigtsen
2019-08-16  1:04   ` Lars Ingebrigtsen
2019-08-16  1:31   ` Glenn Morris
2019-08-16  1:40     ` Lars Ingebrigtsen

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