all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#69894: 29.1; Icalendar export conflict with calendar iso date
@ 2024-03-19  1:56 RwN via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-28  9:53 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: RwN via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-19  1:56 UTC (permalink / raw)
  To: 69894


Dear All,

In a diary file, with a simple entry entry "2024-03-19 10:00 Appointment", icalendar-export-file process to an error: "Could not parse date". The entry is provided by the default value of calendar-iso-date-display-form.

I solve the problem with the following patch mathchin '-' has a separator in the function icalendar--datestring-to-isodate :

diff -u --label /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz --label /tmp/icalendar.el /tmp/jka-commHr8dl /tmp/icalendar.el
--- /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz
+++ /tmp/icalendar.el
@@ -894,8 +894,8 @@
     (save-match-data
       (cond ( ;; iso-style numeric date
              (string-match (concat "\\s-*"
-                                   "\\([0-9]\\{4\\}\\)[ \t/]\\s-*"
-                                   "0?\\([1-9][0-9]?\\)[ \t/]\\s-*"
+                                   "\\([0-9]\\{4\\}\\)[ \t/-]\\s-*"
+                                   "0?\\([1-9][0-9]?\\)[ \t/-]\\s-*"
                                    "0?\\([1-9][0-9]?\\)")
                            datestring)
              (setq year (read (substring datestring (match-beginning 1)

Diff finished.  Tue Mar 19 02:40:06 2024

Is it a correct solution to proposed? 
RwN.



In GNU Emacs 29.1 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-10-16 built on laptop
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.4 LTS

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  marginalia-mode: t
  vertico-mode: t
  recentf-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  minibuffer-depth-indicate-mode: t
  windmove-mode: t
  delete-selection-mode: t
  server-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/erwan/.emacs.d/etc/custom hides /usr/local/share/emacs/29.1/lisp/custom

Features:
(shadow sort flycheck-grammalecte grammalecte flycheck flyspell ispell mail-extr emacsbug vertico-directory cl-extra help-mode orderless cursor-sensor display-line-numbers display-fill-column-indicator rwn-emacs-completion marginalia vertico compat recentf tree-widget savehist minibuf-eldef mb-depth rwn-emacs-diary mc tempo-api request french-holidays holidays holiday-loaddefs appt diary-lib diary-loaddefs solar cal-dst rwn-emacs-windows rwn-emacs-spelling rwn-emacs-vc rwn-emacs-dired dired-preview rwn-emacs-latex rwn-emacs-pdf pdf-loader rwn-emacs-mail rwn-mail mu4e mu4e-org org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete pcomplete org-list org-footnote org-faces org-entities noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func org-version org-compat org-macs format-spec mu4e-notification notifications mu4e-main smtpmail mu4e-view pcase mu4e-mime-parts thingatpt comint ansi-osc ansi-color ring gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus wid-edit cal-menu calendar cal-loaddefs mu4e-headers mu4e-thread mu4e-actions mu4e-compose nnheader range mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message shr pixel-fill kinsoku url-file svg xml dom flow-fill mule-util hl-line mu4e-contacts mu4e-update mu4e-folders mu4e-context mu4e-query-items mu4e-server mu4e-modeline mu4e-vars mu4e-helpers mu4e-config mu4e-window bookmark pp ido message sendmail yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader mu4e-obsolete rwn-emacs-themes standard-dark-theme standard-themes rwn-emacs-packages finder-inf auctex-autoloads tex-site biblio-autoloads biblio-core-autoloads citar-embark-autoloads citar-autoloads citeproc-autoloads consult-autoloads dired-preview-autoloads embark-autoloads f-autoloads dash-autoloads flycheck-grammalecte-autoloads flycheck-autoloads marginalia-autoloads messages-are-flowing-autoloads orderless-autoloads parsebib-autoloads pdf-tools-autoloads pkg-info-autoloads epl-autoloads queue-autoloads request-autoloads s-autoloads standard-themes-autoloads string-inflection-autoloads sudo-edit-autoloads tablist-autoloads vertico-autoloads info compat-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars rwn-emacs-essentials windmove delsel rwn-common cl-loaddefs cl-lib server rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 468357 33831)
 (symbols 48 30514 4)
 (strings 32 153392 6568)
 (string-bytes 1 4223999)
 (vectors 16 50001)
 (vector-slots 8 578847 29215)
 (floats 8 615 116)
 (intervals 56 357 175)
 (buffers 976 11))









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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-03-19  1:56 bug#69894: 29.1; Icalendar export conflict with calendar iso date RwN via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-28  9:53 ` Eli Zaretskii
  2024-03-28 21:26   ` Paul Eggert
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-03-28  9:53 UTC (permalink / raw)
  To: RwN, Paul Eggert; +Cc: 69894

> Date: Tue, 19 Mar 2024 02:56:57 +0100
> From:  RwN via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 
> Dear All,
> 
> In a diary file, with a simple entry entry "2024-03-19 10:00 Appointment", icalendar-export-file process to an error: "Could not parse date". The entry is provided by the default value of calendar-iso-date-display-form.
> 
> I solve the problem with the following patch mathchin '-' has a separator in the function icalendar--datestring-to-isodate :
> 
> diff -u --label /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz --label /tmp/icalendar.el /tmp/jka-commHr8dl /tmp/icalendar.el
> --- /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz
> +++ /tmp/icalendar.el
> @@ -894,8 +894,8 @@
>      (save-match-data
>        (cond ( ;; iso-style numeric date
>               (string-match (concat "\\s-*"
> -                                   "\\([0-9]\\{4\\}\\)[ \t/]\\s-*"
> -                                   "0?\\([1-9][0-9]?\\)[ \t/]\\s-*"
> +                                   "\\([0-9]\\{4\\}\\)[ \t/-]\\s-*"
> +                                   "0?\\([1-9][0-9]?\\)[ \t/-]\\s-*"
>                                     "0?\\([1-9][0-9]?\\)")
>                             datestring)
>               (setq year (read (substring datestring (match-beginning 1)
> 
> Diff finished.  Tue Mar 19 02:40:06 2024
> 
> Is it a correct solution to proposed? 

Paul, WDYT about the proposed change?





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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-03-28  9:53 ` Eli Zaretskii
@ 2024-03-28 21:26   ` Paul Eggert
  2024-03-28 21:49     ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Eggert @ 2024-03-28 21:26 UTC (permalink / raw)
  To: Eli Zaretskii, RwN; +Cc: 69894

On 3/28/24 03:53, Eli Zaretskii wrote:
>> diff -u --label /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz --label /tmp/icalendar.el /tmp/jka-commHr8dl /tmp/icalendar.el
>> --- /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz
>> +++ /tmp/icalendar.el
>> @@ -894,8 +894,8 @@
>>       (save-match-data
>>         (cond ( ;; iso-style numeric date
>>                (string-match (concat "\\s-*"
>> -                                   "\\([0-9]\\{4\\}\\)[ \t/]\\s-*"
>> -                                   "0?\\([1-9][0-9]?\\)[ \t/]\\s-*"
>> +                                   "\\([0-9]\\{4\\}\\)[ \t/-]\\s-*"
>> +                                   "0?\\([1-9][0-9]?\\)[ \t/-]\\s-*"
>>                                      "0?\\([1-9][0-9]?\\)")
>>                              datestring)
>>                (setq year (read (substring datestring (match-beginning 1)
>>
>> Diff finished.  Tue Mar 19 02:40:06 2024
>>
>> Is it a correct solution to proposed?
> Paul, WDYT about the proposed change?

I'm no expert on diary files. Certainly the "-" is ISO format (space and 
tab are not).

By the way, those two instances of 0?\\([1-9][0-9]?\\) both look bogus 
to me, as they match strings like 099 that are implausible month or 
day-of-month numbers.





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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-03-28 21:26   ` Paul Eggert
@ 2024-03-28 21:49     ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-06  9:58       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-28 21:49 UTC (permalink / raw)
  To: Paul Eggert; +Cc: RwN, Eli Zaretskii, 69894

Sorry I cannot help much because I am not an expert in 
regexp.... I just find a patch which work for me. The 0? is not in 
the match, the function assume a good structure of the diary file 
so 2024 099 03 will match 2024 99 3 if I am right? What I am 
concern is considering - instead of space likewise the default ISO 
format used .

E.

Paul Eggert <eggert@cs.ucla.edu> writes:

> On 3/28/24 03:53, Eli Zaretskii wrote:
>>> diff -u --label 
>>> /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz 
>>> --label /tmp/icalendar.el /tmp/jka-commHr8dl /tmp/icalendar.el
>>> --- /usr/local/share/emacs/29.1/lisp/calendar/icalendar.el.gz
>>> +++ /tmp/icalendar.el
>>> @@ -894,8 +894,8 @@
>>>       (save-match-data
>>>         (cond ( ;; iso-style numeric date
>>>                (string-match (concat "\\s-*"
>>> -                                   "\\([0-9]\\{4\\}\\)[ 
>>> \t/]\\s-*"
>>> -                                   "0?\\([1-9][0-9]?\\)[ 
>>> \t/]\\s-*"
>>> +                                   "\\([0-9]\\{4\\}\\)[ 
>>> \t/-]\\s-*"
>>> +                                   "0?\\([1-9][0-9]?\\)[ 
>>> \t/-]\\s-*"
>>>                                      "0?\\([1-9][0-9]?\\)")
>>>                              datestring)
>>>                (setq year (read (substring datestring 
>>>                (match-beginning 1)
>>>
>>> Diff finished.  Tue Mar 19 02:40:06 2024
>>>
>>> Is it a correct solution to proposed?
>> Paul, WDYT about the proposed change?
>
> I'm no expert on diary files. Certainly the "-" is ISO format 
> (space and tab are not).
>
> By the way, those two instances of 0?\\([1-9][0-9]?\\) both look 
> bogus to me, as they
> match strings like 099 that are implausible month or 
> day-of-month numbers.







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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-03-28 21:49     ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-06  9:58       ` Eli Zaretskii
  2024-04-06 10:34         ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-08  5:50         ` Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-04-06  9:58 UTC (permalink / raw)
  To: Erwan Hingant, Ulf Jasper; +Cc: rwn, eggert, 69894

> From: Erwan Hingant <erwan.hingant@mailo.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,   RwN <rwn@mailo.com>,
>    69894@debbugs.gnu.org
> Date: Thu, 28 Mar 2024 22:49:33 +0100
> 
> Sorry I cannot help much because I am not an expert in 
> regexp.... I just find a patch which work for me. The 0? is not in 
> the match, the function assume a good structure of the diary file 
> so 2024 099 03 will match 2024 99 3 if I am right? What I am 
> concern is considering - instead of space likewise the default ISO 
> format used .

Can you tell how you arrived at a date such as "2024-03-19" in the
diary file?  Did you per chance write it by hand or something?  If any
of the diary commands produce such dates, can you show a recipe for
reproducing this?

AFAIU, what icalendar--datestring-to-isodate accepts as DATESTRING is
a diary-style date, and the ISO format of diary-style dates doesn't
allow dashes.  So I 'm curious as to how those dashes ended up in your
diary file.

Ulf, any comments about this?





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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-04-06  9:58       ` Eli Zaretskii
@ 2024-04-06 10:34         ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-08  5:50         ` Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 8+ messages in thread
From: Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-06 10:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Ulf Jasper, rwn, eggert, 69894

Hello,

This is the ISO format has a '-'. Proceed with :

(setq diary-file "whatever"
      calendar-date-display-form calendar-iso-date-display-form)

Then, go to calendar and use "i d" on any date or 
(diary-insert-entry) you will see the date inserted in the form 
YYYY-MM-DD. 

Indeed, diary-insert-entry call the calendar-insert-date-string 
which use the format stroed in calendar-date-display-form. You may 
inspect the default proposed value of 
calendar-iso-date-display-form.

Sincerely,
E.


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Erwan Hingant <erwan.hingant@mailo.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,   RwN <rwn@mailo.com>,
>>    69894@debbugs.gnu.org
>> Date: Thu, 28 Mar 2024 22:49:33 +0100
>> 
>> Sorry I cannot help much because I am not an expert in 
>> regexp.... I just find a patch which work for me. The 0? is not 
>> in 
>> the match, the function assume a good structure of the diary 
>> file 
>> so 2024 099 03 will match 2024 99 3 if I am right? What I am 
>> concern is considering - instead of space likewise the default 
>> ISO 
>> format used .
>
> Can you tell how you arrived at a date such as "2024-03-19" in 
> the
> diary file?  Did you per chance write it by hand or something? 
> If any
> of the diary commands produce such dates, can you show a recipe 
> for
> reproducing this?
>
> AFAIU, what icalendar--datestring-to-isodate accepts as 
> DATESTRING is
> a diary-style date, and the ISO format of diary-style dates 
> doesn't
> allow dashes.  So I 'm curious as to how those dashes ended up 
> in your
> diary file.
>
> Ulf, any comments about this?







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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-04-06  9:58       ` Eli Zaretskii
  2024-04-06 10:34         ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-08  5:50         ` Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-13  7:54           ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-08  5:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rwn, eggert, 69894, Erwan Hingant

Am 06.04.2024 um 12:58 (+0300) schrieb Eli Zaretskii:
>> From: Erwan Hingant <erwan.hingant@mailo.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,   RwN <rwn@mailo.com>,
>>    69894@debbugs.gnu.org
>> Date: Thu, 28 Mar 2024 22:49:33 +0100
>>
>> Sorry I cannot help much because I am not an expert in
>> regexp.... I just find a patch which work for me. The 0? is not in
>> the match, the function assume a good structure of the diary file
>> so 2024 099 03 will match 2024 99 3 if I am right? What I am
>> concern is considering - instead of space likewise the default ISO
>> format used .
>
> Can you tell how you arrived at a date such as "2024-03-19" in the
> diary file?  Did you per chance write it by hand or something?  If any
> of the diary commands produce such dates, can you show a recipe for
> reproducing this?
>
> AFAIU, what icalendar--datestring-to-isodate accepts as DATESTRING is
> a diary-style date, and the ISO format of diary-style dates doesn't
> allow dashes.  So I 'm curious as to how those dashes ended up in your
> diary file.
>
> Ulf, any comments about this?

'icalendar--datestring-to-isodate' does not expect dashes in iso style
input strings (as the observation/patch shows).  However, if the diary
machine accepts dashes then 'icalendar--datestring-to-isodate' should
also do so.

I would add some testcases to the ert test of
'icalendar--datestring-to-isodate' and then apply the patch.





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

* bug#69894: 29.1; Icalendar export conflict with calendar iso date
  2024-04-08  5:50         ` Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-13  7:54           ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-04-13  7:54 UTC (permalink / raw)
  To: Ulf Jasper; +Cc: rwn, eggert, erwan.hingant, 69894-done

> From: Ulf Jasper <ulf.jasper@web.de>
> Cc: Erwan Hingant <erwan.hingant@mailo.com>,  rwn@mailo.com,
>   eggert@cs.ucla.edu,  69894@debbugs.gnu.org
> Date: Mon, 08 Apr 2024 07:50:48 +0200
> 
> Am 06.04.2024 um 12:58 (+0300) schrieb Eli Zaretskii:
> 
> 'icalendar--datestring-to-isodate' does not expect dashes in iso style
> input strings (as the observation/patch shows).  However, if the diary
> machine accepts dashes then 'icalendar--datestring-to-isodate' should
> also do so.
> 
> I would add some testcases to the ert test of
> 'icalendar--datestring-to-isodate' and then apply the patch.

Thanks, done on the master branch, and closing the bug.





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

end of thread, other threads:[~2024-04-13  7:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-19  1:56 bug#69894: 29.1; Icalendar export conflict with calendar iso date RwN via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28  9:53 ` Eli Zaretskii
2024-03-28 21:26   ` Paul Eggert
2024-03-28 21:49     ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-06  9:58       ` Eli Zaretskii
2024-04-06 10:34         ` Erwan Hingant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-08  5:50         ` Ulf Jasper via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  7:54           ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.