emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] LANG=fr_FR.UTF-8 org-clock "not at timestamp"
@ 2023-04-23  9:42 Ruijie Yu via General discussions about Org-mode.
  2023-04-24  9:56 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-04-23  9:42 UTC (permalink / raw)
  To: Emacs orgmode

Hello,

I am investigating test failures with LANG=fr_FR.UTF-8 amongst some
other locales.  I noticed that the test
`test-org-clok/org-clock-timestamps-change' in
testing/lisp/test-org-clock.el around line 92 failed with "not at
timestamp", which I presume reveals a genuine bug.

To simplify, here is a reproducer:

--8<---------------cut here---------------start------------->8---
(require 'org-clock)
(with-temp-buffer
  (org-mode)
  (insert "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05")
  (goto-char 25)                        ; 2|2:30
  (org-clock-timestamps-change 'down 1))
--8<---------------cut here---------------end--------------->8---

The error appears: "Not at timestamp".  I think it is due to the "." in
French day-of-week words, such as "dim.", "lun.", etc.  Something must
not be expecting punctuations in that place.

Reproduced in newest orgmode, and 1-month old Emacs master.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]


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

* Re: [BUG] LANG=fr_FR.UTF-8 org-clock "not at timestamp"
  2023-04-23  9:42 [BUG] LANG=fr_FR.UTF-8 org-clock "not at timestamp" Ruijie Yu via General discussions about Org-mode.
@ 2023-04-24  9:56 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-04-24  9:56 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: Emacs orgmode

Ruijie Yu via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:

> I am investigating test failures with LANG=fr_FR.UTF-8 amongst some
> other locales.  I noticed that the test
> `test-org-clok/org-clock-timestamps-change' in
> testing/lisp/test-org-clock.el around line 92 failed with "not at
> timestamp", which I presume reveals a genuine bug.
>
> To simplify, here is a reproducer:
>
> --8<---------------cut here---------------start------------->8---
> (require 'org-clock)
> (with-temp-buffer
>   (org-mode)
>   (insert "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05")
>   (goto-char 25)                        ; 2|2:30
>   (org-clock-timestamps-change 'down 1))
> --8<---------------cut here---------------end--------------->8---

Confirmed.

> The error appears: "Not at timestamp".  I think it is due to the "." in
> French day-of-week words, such as "dim.", "lun.", etc.  Something must
> not be expecting punctuations in that place.

Nope. It is because the total length of the timestamp changes.
`org-clock-timestamps-change' records buffer positions before changing
the timestamps and when the timestamp changes in length, positions may
no longer be accurate. In your reproducer, begts2 points one char before
the actual timestamp upon modification and thus the logic fails.

Note that we cannot use markers here because `org-timestamp-up'/down use
`replace-match' that shuffles the markers around. (see FIXME in
`org-timestamp-change').

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-04-24  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-23  9:42 [BUG] LANG=fr_FR.UTF-8 org-clock "not at timestamp" Ruijie Yu via General discussions about Org-mode.
2023-04-24  9:56 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).