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

* bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-15  7:30 UTC (permalink / raw)
  To: Andreas Merziger; +Cc: 13536

Andreas Merziger <andreas.merziger@online.de> writes:

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

(I'm going through old bug reports that have unfortunately gotten no
responses yet.)

I don't use Calendar that much, but I don't quite understand this use
case.  If you have "10am" in your diary file, and then you set the date
style to `european', then surely that diary file will be invalid?
"10am" isn't a valid `european' way to specify a time, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
  2019-08-15  7:30 ` Lars Ingebrigtsen
@ 2019-08-16  1:04   ` Lars Ingebrigtsen
  2019-08-16  1:31   ` Glenn Morris
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-16  1:04 UTC (permalink / raw)
  To: 13536

The mail bounced, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






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

* bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2019-08-16  1:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Andreas Merziger, 13536

Lars Ingebrigtsen wrote:

> I don't use Calendar that much, but I don't quite understand this use
> case.  If you have "10am" in your diary file, and then you set the date
> style to `european', then surely that diary file will be invalid?
> "10am" isn't a valid `european' way to specify a time, I think?

The default value of diary-european-date-forms obviously tries to
support times of the form "10:00", "10am", "10AM", "10pm", "10PM".

The various elements of said form should be mutually exclusive but
aren't, as the OP demonstrates.

This seemed like a valid bug report to me, but I never cared enough to
do anything about it.

IMO applying the suggested fix or leaving it open would be better than
closing it due to a bouncing email.





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

* bug#13536: 24.2; Patterns in `diary-european-date-forms' NOT mutually exclusive -- incl. suggested Fix
  2019-08-16  1:31   ` Glenn Morris
@ 2019-08-16  1:40     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-16  1:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Andreas Merziger, 13536

Glenn Morris <rgm@gnu.org> writes:

> The default value of diary-european-date-forms obviously tries to
> support times of the form "10:00", "10am", "10AM", "10pm", "10PM".
>
> The various elements of said form should be mutually exclusive but
> aren't, as the OP demonstrates.
>
> This seemed like a valid bug report to me, but I never cared enough to
> do anything about it.

Oh, I missed that bit in the value above ("backup day") which indeed
supports AM/PM.

So I've applied the change now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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