GNU bug report logs - #53393
29.0.50; org mode timestamp C-c C-c not updating day of week

Previous Next

Package: org-mode;

Reported by: "Bruce E. Robertson" <brucer42 <at> gmail.com>

Date: Thu, 20 Jan 2022 18:10:01 UTC

Severity: normal

Full log


Message #12 received at 53393 <at> debbugs.gnu.org (full text, mbox):

From: Kyle Meyer <kyle <at> kyleam.com>
To: "Bruce E. Robertson" <brucer42 <at> gmail.com>
Cc: 53393 <at> debbugs.gnu.org
Subject: Re: bug#53393: 29.0.50; org mode timestamp C-c C-c not updating day
 of week
Date: Thu, 20 Jan 2022 20:35:07 -0500
[ I've reassigned this bug report so that new messages will be directed
  to the Org mailing list, where it's more likely to get a reply.  In
  the future, please consider using org-submit-bug-report or sending a
  message to emacs-orgmode <at> gnu.org directly. ]

Bruce E. Robertson writes:

> emacs -Q test.org
> cursor to "CLOCK:" line, C-c C-c
> total time updates but day of week does not change
> contents of test.org
> ------
> * heading
> :LOGBOOK:
> CLOCK: [2022-01-17 Tue 10:29]--[2022-01-19 Tue 10:29] => 48:00
> :END:
> ------
> typing C-c C-c does update total log time for line and recently did
> update the day of the week but no long does

I'm having trouble finding an Org version where it will update a
timestamp _within_ a clock line.  I tried it out with v9.1 and the day
of the week still isn't updated.  Outside of that context it will, as
org-ctrl-c-ctrl-c-hook gets through to its timestamp condition rather
than taking the clock branch.

If you can provide more details about a version where it did work,
showing it's a regression, I think you'll have a higher chance of
getting this fixed.

Anyway, at least for now, perhaps you could try something like this to
get the behavior you want:

  (defun my/update-clock-and-days ()
    (when (eq (org-element-type (org-element-context)) 'clock)
      (let ((re (org-re-timestamp 'inactive)))
        (save-excursion
          (goto-char (line-beginning-position))
          (while (re-search-forward re (line-end-position) t)
            (backward-char)
            (org-timestamp-change 0 'day))))))
  
  (add-hook 'org-ctrl-c-ctrl-c-hook #'my/update-clock-and-days)

With that, hitting `C-c C-c` on the clock line at

--8<---------------cut here---------------start------------->8---
* heading
:LOGBOOK:
CLOCK: [2022-01-17 Thu 10:29]--[2022-01-19 Sun 10:29] => 40:00
:END:
--8<---------------cut here---------------end--------------->8---

produces

--8<---------------cut here---------------start------------->8---
* heading
:LOGBOOK:
CLOCK: [2022-01-17 Mon 10:29]--[2022-01-19 Wed 10:29] => 48:00
:END:
--8<---------------cut here---------------end--------------->8---




This bug report was last modified 2 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.