unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53702: 27.1; diary does not display some entries in european style
@ 2022-02-01 16:21 Francesco Potortì
  2022-02-02  0:39 ` Michael Heerdegen
  2022-02-02  0:39 ` Michael Heerdegen
  0 siblings, 2 replies; 10+ messages in thread
From: Francesco Potortì @ 2022-02-01 16:21 UTC (permalink / raw)
  To: 53702

Diary entries are not parsed by M-x diary if:
- calendar-date-style is set to european (rather than american)
AND
- the date is written as "3 Feb" (rather than 3/2)
AND
- the time is written as "18.00" (rather than 18:00)

At least, this is what I have found by trial and error.  I looked at the code in appt.el and diary-lib.el but was not able to find the culprit...

To reproduce:

$ emacs -Q -nw --load=appt-bug.el

You will see that only two european entries are shown (t1 and t2).

Then exit Emacs, comment out the second line in appt-bug-el and rerun Emacs as above: you will see four american entries (t1, t2, t3, t4).


================ appt-bug.el
(setq diary-file "~/appt-bug-diary"
      calendar-date-style 'european
      )
(load-library "diary-lib")
(diary-list-entries (list 2 3 (decoded-time-year (decode-time))) 1)


================ appt-bug-diary
	-*-diary-*-

3 Feb	18:00 t1 works (european)

3/2	18.00 t2 works (european)

3 Feb	18.00 t3 does not work (european)

3 Feb
	18.00 t4 does not work (european)

Feb 3	18:00 t1 works (american)

2/3	18.00 t2 works (american)

Feb 3	18.00 t3 works (american)

Feb 3
	18.00 t4 works (american)





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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-02-01 16:21 bug#53702: 27.1; diary does not display some entries in european style Francesco Potortì
@ 2022-02-02  0:39 ` Michael Heerdegen
  2022-02-02  0:39 ` Michael Heerdegen
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Heerdegen @ 2022-02-02  0:39 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 53702

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

Francesco Potortì <pot@gnu.org> writes:

> (setq diary-file "~/appt-bug-diary"
>       calendar-date-style 'european
>       )

The recipe should better call the function `calendar-set-date-style'
because "setting this variable [calendar-date-style] directly does not
take effect (if the calendar package is already loaded).

But that doesn't prevent the issue - the report is valid nonetheless.
One already sees in the diary file that the problematic lines are not
fontified.

The manual describes that different time formats can be mixed, and

  3 Feb	18.00 t3 does not work (european)

is not invalid AFAIU (`diary-entry-time': "A period (.) can be used
instead of a colon (:) to separate the hour and minute parts.").

The problem is actually that the date part is rejected because the time
format is not recognized by `diary-european-date-forms'.  This seems to
fix it:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Try-to-fix-53702.patch --]
[-- Type: text/x-diff, Size: 940 bytes --]

From 07a072db84ec722e4e77d02c4d6aa77cafc19354 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 2 Feb 2022 01:08:43 +0100
Subject: [PATCH] WIP: Try to fix #53702

---
 lisp/calendar/calendar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 48d308afad..d578d1a251 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -800,7 +800,7 @@ diary-american-date-forms
 (defcustom diary-european-date-forms
   '((day "/" month "[^/0-9]")
     (day "/" month "/" year "[^0-9]")
-    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
+    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:.aApP]\\)\\)")
     (day " *" monthname " *" year "[^0-9:aApP]")
     (dayname "\\W"))
   "List of pseudo-patterns describing the European style of dates.
--
2.30.2


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


See also Bug#13536 which touched that definition.

We must be sure that the entries of `diary-european-date-forms' are
still mutually exclusive.  `year' never contains a dot "." (that regexp
is built in `diary-list-entries-2'), so I guess we are save... right?

Michael.

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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-02-01 16:21 bug#53702: 27.1; diary does not display some entries in european style Francesco Potortì
  2022-02-02  0:39 ` Michael Heerdegen
@ 2022-02-02  0:39 ` Michael Heerdegen
  2022-02-02  3:41   ` Michael Heerdegen
  1 sibling, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2022-02-02  0:39 UTC (permalink / raw)
  To: 53702

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

Francesco Potortì <pot@gnu.org> writes:

> (setq diary-file "~/appt-bug-diary"
>       calendar-date-style 'european
>       )

The recipe should better call the function `calendar-set-date-style'
because "setting this variable [calendar-date-style] directly does not
take effect (if the calendar package is already loaded).

But that doesn't prevent the issue - the report is valid nonetheless.
One already sees in the diary file that the problematic lines are not
fontified.

The manual describes that different time formats can be mixed, and

  3 Feb	18.00 t3 does not work (european)

is not invalid AFAIU (`diary-entry-time': "A period (.) can be used
instead of a colon (:) to separate the hour and minute parts.").

The problem is actually that the date part is rejected because the time
format is not recognized by `diary-european-date-forms'.  This seems to
fix it:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Try-to-fix-53702.patch --]
[-- Type: text/x-diff, Size: 915 bytes --]

From 07a072db84ec722e4e77d02c4d6aa77cafc19354 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 2 Feb 2022 01:08:43 +0100
Subject: [PATCH] WIP: Try to fix #53702

---
 lisp/calendar/calendar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 48d308afad..d578d1a251 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -800,7 +800,7 @@ diary-american-date-forms
 (defcustom diary-european-date-forms
   '((day "/" month "[^/0-9]")
     (day "/" month "/" year "[^0-9]")
-    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
+    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:.aApP]\\)\\)")
     (day " *" monthname " *" year "[^0-9:aApP]")
     (dayname "\\W"))
   "List of pseudo-patterns describing the European style of dates.
--
2.30.2


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


See also Bug#13536 which touched that definition.

We must be sure that the entries of `diary-european-date-forms' are
still mutually exclusive.  `year' never contains a dot "." (that regexp
is built in `diary-list-entries-2'), so I guess we are save... right?

Michael.

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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-02-02  0:39 ` Michael Heerdegen
@ 2022-02-02  3:41   ` Michael Heerdegen
  2022-03-04  2:00     ` Michael Heerdegen
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2022-02-02  3:41 UTC (permalink / raw)
  To: 53702

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

Hello again,

sorry for the duplicated last message - my first message had bounced,
but apparently only from the poster's address.

Ok - small addition: the dot should be added in the subsequent line as
well:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Try-to-fix-53702.patch --]
[-- Type: text/x-diff, Size: 1058 bytes --]

From 5346b90b9884b9190cfe77310f2444ed35d182eb Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 2 Feb 2022 01:08:43 +0100
Subject: [PATCH] WIP: Try to fix #53702

---
 lisp/calendar/calendar.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 48d308afad..0605e4bf51 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -800,8 +800,8 @@ diary-american-date-forms
 (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:aApP]")
+    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:.aApP]\\)\\)")
+    (day " *" monthname " *" year "[^0-9:.aApP]")
     (dayname "\\W"))
   "List of pseudo-patterns describing the European style of dates.
 The defaults are: DAY/MONTH; DAY/MONTH/YEAR; DAY MONTHNAME;
--
2.30.2


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



I'm now a bit worried about this paragraph in
(info "(emacs) Appointments"):

|    You can write times in am/pm style (with ‘12:00am’ standing for
| midnight and ‘12:00pm’ standing for noon), or 24-hour European/military
| style.  You need not be consistent; your diary file can have a mixture
| of the two styles.  Times must be at the beginning of diary entries if
| they are to be recognized.

Military style is 1200 for 12:00am, right?  This definitely can't be
used everywhere when using the European style because lines get
ambiguous: for digits could mean a year - or a military time in a line
not specifying a year.  Should that paragraph be corrected?

Michael.

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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-02-02  3:41   ` Michael Heerdegen
@ 2022-03-04  2:00     ` Michael Heerdegen
  2022-09-08 13:29       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2022-03-04  2:00 UTC (permalink / raw)
  To: 53702

Hello Francesco,

did you have the chance to try if that patch (repeated below) fixes your
problem?

Regards,

Michael.

> From 5346b90b9884b9190cfe77310f2444ed35d182eb Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Wed, 2 Feb 2022 01:08:43 +0100
> Subject: [PATCH] WIP: Try to fix #53702
>
> ---
>  lisp/calendar/calendar.el | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
> index 48d308afad..0605e4bf51 100644
> --- a/lisp/calendar/calendar.el
> +++ b/lisp/calendar/calendar.el
> @@ -800,8 +800,8 @@ diary-american-date-forms
>  (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:aApP]")
> +    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:.aApP]\\)\\)")
> +    (day " *" monthname " *" year "[^0-9:.aApP]")
>      (dayname "\\W"))
>    "List of pseudo-patterns describing the European style of dates.
>  The defaults are: DAY/MONTH; DAY/MONTH/YEAR; DAY MONTHNAME;
> --
> 2.30.2
>





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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-03-04  2:00     ` Michael Heerdegen
@ 2022-09-08 13:29       ` Lars Ingebrigtsen
  2022-09-08 13:41         ` Francesco Potortì
  2022-09-09  4:13         ` Michael Heerdegen
  0 siblings, 2 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-08 13:29 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Francesco Potortì, 53702

Michael Heerdegen <michael_heerdegen@web.de> writes:

> did you have the chance to try if that patch (repeated below) fixes your
> problem?

This was half a year ago, but I see that Francesco wasn't in the CCs, so
perhaps he never got the message?

Francesco, can you try Michael's patch and see whether that fixes the
problem?

> I'm now a bit worried about this paragraph in
> (info "(emacs) Appointments"):
>
> |    You can write times in am/pm style (with ‘12:00am’ standing for
> | midnight and ‘12:00pm’ standing for noon), or 24-hour European/military
> | style.  You need not be consistent; your diary file can have a mixture
> | of the two styles.  Times must be at the beginning of diary entries if
> | they are to be recognized.
>
> Military style is 1200 for 12:00am, right?  This definitely can't be
> used everywhere when using the European style because lines get
> ambiguous: for digits could mean a year - or a military time in a line
> not specifying a year.  Should that paragraph be corrected?

12:00am (midnight) is the same as 00:00/24:00 in military style.






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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-09-08 13:29       ` Lars Ingebrigtsen
@ 2022-09-08 13:41         ` Francesco Potortì
  2022-09-08 13:45           ` Lars Ingebrigtsen
  2022-09-09  4:13         ` Michael Heerdegen
  1 sibling, 1 reply; 10+ messages in thread
From: Francesco Potortì @ 2022-09-08 13:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, 53702

>Michael Heerdegen <michael_heerdegen@web.de> writes:
>> did you have the chance to try if that patch (repeated below) fixes your
>> problem?
>
>This was half a year ago, but I see that Francesco wasn't in the CCs, so
>perhaps he never got the message?

I suspect so...

>Francesco, can you try Michael's patch and see whether that fixes the
>problem?

Yes.  Can you please send it to me together with my report? (I don't remember the problem any more...)

>> I'm now a bit worried about this paragraph in
>> (info "(emacs) Appointments"):
>>
>> |    You can write times in am/pm style (with ‘12:00am’ standing for
>> | midnight and ‘12:00pm’ standing for noon), or 24-hour European/military
>> | style.  You need not be consistent; your diary file can have a mixture
>> | of the two styles.  Times must be at the beginning of diary entries if
>> | they are to be recognized.
>>
>> Military style is 1200 for 12:00am, right?

Mh.  Military style is 12:00 (or 12.00) for noon.  That's for sure.

I suppose that in am/pm style we have:
00:00 am midnight this day
11:59 am one minute to noon today
00:00 pm noon
11:59 pm one minute to midnight today

This would imply what is written in the paragraph you cited above.





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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-09-08 13:41         ` Francesco Potortì
@ 2022-09-08 13:45           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-08 13:45 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: Michael Heerdegen, 53702

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

Francesco Potortì <pot@gnu.org> writes:

> Yes.  Can you please send it to me together with my report? (I don't
> remember the problem any more...)

Patch included below, and here's the original report:

Diary entries are not parsed by M-x diary if:
- calendar-date-style is set to european (rather than american)
AND
- the date is written as "3 Feb" (rather than 3/2)
AND
- the time is written as "18.00" (rather than 18:00)

At least, this is what I have found by trial and error.  I looked at the code in appt.el and diary-lib.el but was not able to find the culprit...

To reproduce:

$ emacs -Q -nw --load=appt-bug.el

You will see that only two european entries are shown (t1 and t2).

Then exit Emacs, comment out the second line in appt-bug-el and rerun Emacs as above: you will see four american entries (t1, t2, t3, t4).

================ appt-bug.el
(setq diary-file "~/appt-bug-diary"
      calendar-date-style 'european
      )
(load-library "diary-lib")
(diary-list-entries (list 2 3 (decoded-time-year (decode-time))) 1)

================ appt-bug-diary
	-*-diary-*-

3 Feb	18:00 t1 works (european)

3/2	18.00 t2 works (european)

3 Feb	18.00 t3 does not work (european)

3 Feb
	18.00 t4 does not work (european)

Feb 3	18:00 t1 works (american)

2/3	18.00 t2 works (american)

Feb 3	18.00 t3 works (american)

Feb 3
	18.00 t4 works (american)



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Try-to-fix-53702.patch --]
[-- Type: text/x-diff, Size: 1031 bytes --]

From 5346b90b9884b9190cfe77310f2444ed35d182eb Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 2 Feb 2022 01:08:43 +0100
Subject: [PATCH] WIP: Try to fix #53702

---
 lisp/calendar/calendar.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 48d308afad..0605e4bf51 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -800,8 +800,8 @@ diary-american-date-forms
 (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:aApP]")
+    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:.aApP]\\)\\)")
+    (day " *" monthname " *" year "[^0-9:.aApP]")
     (dayname "\\W"))
   "List of pseudo-patterns describing the European style of dates.
 The defaults are: DAY/MONTH; DAY/MONTH/YEAR; DAY MONTHNAME;
--
2.30.2


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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-09-08 13:29       ` Lars Ingebrigtsen
  2022-09-08 13:41         ` Francesco Potortì
@ 2022-09-09  4:13         ` Michael Heerdegen
  2022-09-09 17:08           ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2022-09-09  4:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Francesco Potortì, 53702

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This was half a year ago, but I see that Francesco wasn't in the CCs, so
> perhaps he never got the message?

I thought the reporter always gets all messages in his bug's thread
automatically?

> 12:00am (midnight) is the same as 00:00/24:00 in military style.

Then my concerns about that paragraph were ill-founded.

Ok, then let's see if Francesco is happy with the patch.

Michael.





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

* bug#53702: 27.1; diary does not display some entries in european style
  2022-09-09  4:13         ` Michael Heerdegen
@ 2022-09-09 17:08           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-09 17:08 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Francesco Potortì, 53702

Michael Heerdegen <michael_heerdegen@web.de> writes:

>> This was half a year ago, but I see that Francesco wasn't in the CCs, so
>> perhaps he never got the message?
>
> I thought the reporter always gets all messages in his bug's thread
> automatically?

I've always assumed that they only get the messages explicitly directed
at them (as well as the response from the "-done" message).  But I don't
really know.  🫠






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

end of thread, other threads:[~2022-09-09 17:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 16:21 bug#53702: 27.1; diary does not display some entries in european style Francesco Potortì
2022-02-02  0:39 ` Michael Heerdegen
2022-02-02  0:39 ` Michael Heerdegen
2022-02-02  3:41   ` Michael Heerdegen
2022-03-04  2:00     ` Michael Heerdegen
2022-09-08 13:29       ` Lars Ingebrigtsen
2022-09-08 13:41         ` Francesco Potortì
2022-09-08 13:45           ` Lars Ingebrigtsen
2022-09-09  4:13         ` Michael Heerdegen
2022-09-09 17:08           ` 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).