unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50216: 27.2; timeclock gives incorrect time in mode-line
@ 2021-08-26 19:11 Colin Baxter
  2021-08-27  1:01 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Baxter @ 2021-08-26 19:11 UTC (permalink / raw)
  To: 50216



Using emacs-28.0.50:

A. First Process

1. No timeclock log file
2. emacs -Q
3. In Scratch buffer, evaluate
   (display-time)
   (timeclock-mode-line-display 1)
   (setq timeclock-workday (* 12 60 60))
4. mode-line reads [0:00]
5. M-x timeclock-in <RET>
6. mode-line reads [11:59]
7. Wait a minute or two.
8. M-x timeclock-out <RET>
9. mode-line reads [11:58]
10. Wrote /home/redknight/.emacs.d/timelog
11. Close emacs.

Emacs correctly counts down the set workday of 12:00 hours.

B. Repeat the process.

1. timeclock log file present
2. emacs -Q
3. In Scratch buffer, evaluate
   (display-time)
   (timeclock-mode-line-display 1)
   (setq timeclock-workday (* 12 60 60))
4. mode-line reads [7:58]
5. Mx timeclock-in <RET>
6. mode-line reads <7:57>
7. Wrote /home/redknight/.emacs.d/timelog
8. Wait a minute or two.
9. M-x timeclock-out <RET>
10. mode-line reads [7:55]
11. Wrote /home/redknight/.emacs.d/timelog
12. Close emacs

Emacs incorrectly counts down workday, starting form the default value of 8 hours even though it was set to 12 hours.

C. Repeat process but change order of lisp

1. timeclock log file present
2. emacs -Q
3. In Scratch buffer, evaluate
   (display-time)
   (setq timeclock-workday (* 12 60 60))
   (timeclock-mode-line-display 1)
4. mode-line reads [11:55]
5. Mx timeclock-in <RET>
6. mode-line reads <11:55>
7. Wrote /home/redknight/.emacs.d/timelog
8. Wait a minute or two.
9. M-x timeclock-out <RET>
10. mode-line reads [11:54]
11. Wrote /home/redknight/.emacs.d/timelog
12. Close emacs

By setting workday before mode-line-display, Emacs gives the correct workday, counting down from the set 12 hours.

D. Repeat first process A. but omit (display-time)

1. No timeclock log file
2. emacs -Q
3. In Scratch buffer, evaluate
   (timeclock-mode-line-display 1)
   Message: "Activate ‘display-time-mode’ or turn off ‘timeclock-use-display-time’ to see timeclock information"
   (setq timeclock-workday (* 12 60 60))
4. M-x timeclock-in <RET>
5. mode-line reads [11:59]
6. Wait a minute or two.
7. M-x timeclock-out <RET>
8. mode-line reads [11:56]
9. Wrote /home/redknight/.emacs.d/timelog
10. Close emacs.

Emacs gives the correct workday.

E. Repeat process but change the lisp order

1. No timeclock log file
2. emacs -Q
3. In Scratch buffer, evaluate
   (setq timeclock-workday (* 12 60 60))
   (timeclock-mode-line-display 1)
   Message: "Activate ‘display-time-mode’ or turn off ‘timeclock-use-display-time’ to see timeclock information"
4. M-x timeclock-in <RET>
5. mode-line reads [11:56]
6. Wait a minute or two.
7. M-x timeclock-out <RET>
8. mode-line reads [11:54]
9. Wrote /home/redknight/.emacs.d/timelog
10. Close emacs.

Emacs again gives the correct workday even when the mode-line display occurs after the workday setting.

The issue seem to be the presence or otherwise of (display-time). If it is present then the display of the set workday of 12 hours depends on when timeclock-mode-line is activated. Only if it is activated after setting the workday does the mode-line display correctly. However, if (display-time) is not used then the user gets an "Activate" message.



In GNU Emacs 27.2 (build 1, i686-pc-linux-gnu, X toolkit, cairo version 1.14.8, Xaw3d scroll bars)
 of 2021-03-28 built on bluestar
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)





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

* bug#50216: 27.2; timeclock gives incorrect time in mode-line
  2021-08-26 19:11 bug#50216: 27.2; timeclock gives incorrect time in mode-line Colin Baxter
@ 2021-08-27  1:01 ` Lars Ingebrigtsen
  2021-08-27  1:13   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27  1:01 UTC (permalink / raw)
  To: Colin Baxter; +Cc: 50216

Colin Baxter <m43cap@yandex.com> writes:

> B. Repeat the process.
>
> 1. timeclock log file present
> 2. emacs -Q
> 3. In Scratch buffer, evaluate
>    (display-time)
>    (timeclock-mode-line-display 1)
>    (setq timeclock-workday (* 12 60 60))
> 4. mode-line reads [7:58]
> 5. Mx timeclock-in <RET>
> 6. mode-line reads <7:57>
> 7. Wrote /home/redknight/.emacs.d/timelog
> 8. Wait a minute or two.
> 9. M-x timeclock-out <RET>
> 10. mode-line reads [7:55]
> 11. Wrote /home/redknight/.emacs.d/timelog
> 12. Close emacs
>
> Emacs incorrectly counts down workday, starting form the default value of 8 hours even though it was set to 12 hours.

Thanks for the detailed recipes.  I tried this in Emacs 28, and I can
reproduce the problem.  However, I'm seeing exactly the same behaviour
in Emacs 27.2 (and earlier), and I think you said over on emacs-devel
that this used to work there?

> E. Repeat process but change the lisp order
>
> 1. No timeclock log file
> 2. emacs -Q
> 3. In Scratch buffer, evaluate
>    (setq timeclock-workday (* 12 60 60))
>    (timeclock-mode-line-display 1)
>    Message: "Activate ‘display-time-mode’ or turn off ‘timeclock-use-display-time’ to see timeclock information"
> 4. M-x timeclock-in <RET>
> 5. mode-line reads [11:56]
> 6. Wait a minute or two.
> 7. M-x timeclock-out <RET>
> 8. mode-line reads [11:54]
> 9. Wrote /home/redknight/.emacs.d/timelog
> 10. Close emacs.
>
> Emacs again gives the correct workday even when the mode-line display
> occurs after the workday setting.
>
> The issue seem to be the presence or otherwise of (display-time).

I'm not so sure.  In all the cases where things work correctly (when
setting timeclock after `timeclock-mode-line-display'), there's no
timelog file.  So the issue seems to be: Setting workday after timeclock
+ having a log file?

I haven't really started debugging in, but the issue seems to be
`timeclock-find-discrep' using some data that was computed before
timeclock-workday was set...

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





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

* bug#50216: 27.2; timeclock gives incorrect time in mode-line
  2021-08-27  1:01 ` Lars Ingebrigtsen
@ 2021-08-27  1:13   ` Lars Ingebrigtsen
  2021-08-27  6:53     ` Colin Baxter
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27  1:13 UTC (permalink / raw)
  To: Colin Baxter; +Cc: 50216

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I haven't really started debugging in, but the issue seems to be
> `timeclock-find-discrep' using some data that was computed before
> timeclock-workday was set...

Yup, that was it -- I made it flush the data on workday changes, and now
it displays correctly for me in the timelog test case -- that is, when
doing timelog-in, it'll use the current timelog-workday setting and
compute stuff correctly.

Note, however, that initial display when doing

(timeclock-mode-line-display 1)
(setq timeclock-workday (* 12 60 60))

will be incorrect -- because setting a variable like this won't trigger
mode-line updates.  (Until a minute has passed and it updates the line.)
So I've noted in the timeclock-mode-line-display doc string that this
shouldn't be done.

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





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

* bug#50216: 27.2; timeclock gives incorrect time in mode-line
  2021-08-27  1:13   ` Lars Ingebrigtsen
@ 2021-08-27  6:53     ` Colin Baxter
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Baxter @ 2021-08-27  6:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50216

>>>>> Lars Ingebrigtsen <larsi@gnus.org> writes:

    > Lars Ingebrigtsen <larsi@gnus.org> writes:
    >> I haven't really started debugging in, but the issue seems to be
    >> `timeclock-find-discrep' using some data that was computed before
    >> timeclock-workday was set...

    > Yup, that was it -- I made it flush the data on workday changes,
    > and now it displays correctly for me in the timelog test case --
    > that is, when doing timelog-in, it'll use the current
    > timelog-workday setting and compute stuff correctly.

    > Note, however, that initial display when doing

    > (timeclock-mode-line-display 1) (setq timeclock-workday (* 12 60
    > 60))

    > will be incorrect -- because setting a variable like this won't
    > trigger mode-line updates.  (Until a minute has passed and it
    > updates the line.)  So I've noted in the
    > timeclock-mode-line-display doc string that this shouldn't be
    > done.

Thank you very much. I think I am *beginning* to understand what's
happening. I was wrong about it only being an emacs-28 issue. As you
wrote in an earlier email, you can see the same effect in emacs-27.

Best wishes,






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

end of thread, other threads:[~2021-08-27  6:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-26 19:11 bug#50216: 27.2; timeclock gives incorrect time in mode-line Colin Baxter
2021-08-27  1:01 ` Lars Ingebrigtsen
2021-08-27  1:13   ` Lars Ingebrigtsen
2021-08-27  6:53     ` Colin Baxter

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