GNU bug report logs - #52235
29.0.50; Suggestion: refactor time.el into a more general 'clock' framework

Previous Next

Package: emacs;

Reported by: Arthur Miller <arthur.miller <at> live.com>

Date: Thu, 2 Dec 2021 01:35:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52235 in the body.
You can then email your comments to 52235 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 01:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arthur Miller <arthur.miller <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 02 Dec 2021 01:35:04 GMT) Full text and rfc822 format available.

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

From: Arthur Miller <arthur.miller <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Suggestion: refactor time.el into a more general 'clock'
 framework
Date: Thu, 02 Dec 2021 00:08:37 +0100
[Message part 1 (text/plain, inline)]
Last few days I have being playing with a clock just to test the transparency,
and what I have noticed is that I don't see some framework to work with clock
time. For tests I have used timer + 60s to get per minut update, but that is of
course skew time.

Emacs has a better "clock" framework in form of 'display-time-mode', but it is
explicitly coupled to mode-line updates. So any application that would like to
per-use it, will also trigger mode-line re-display, regardless if user have
'display-time-mode' on or not.

My idea to per-use it is to simply run 'update-hooks' on clock beat, so any
application can register a hook that will be called on a "clock beat". While it
is maybe not so super-synchronized with system clock, it still gives impression
of clocks in Emacs be synchronized.

Changes look bigger than they are, but I have made some let-bound variables
global, so I can use them as precalculated variables instead of calculating them
in the application code. I am not sure if it is correct. but it's just a test.

Allaround naming is bad, but I tried to be completely backward compatible, so I
had to preserve the old hook/var/mode names.

Example usage is in attached emvac-vision-clock.el, with attached screenshot of
it running.

I haven't thought of how/when to kill timer and internal minor mode properly; I
guess when hooks variable could be tested for nil, but I haven't done it yet.


[time.el.patch (text/x-patch, attachment)]
[emacs-vision-clock.el (text/plain, attachment)]
[clock-on-refactored-time.el.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-11-28 built on pascal
Repository revision: f5498a608fe85b66a4068a5ccf88c9b3d3b88f98
Repository branch: private
Windowing system distributor 'The X.Org Foundation', version 11.0.12101001
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation 'CFLAGS=-O2 -mtune=native -march=native''

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

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  beacon-mode: t
  emms-mode-line-mode: t
  emms-playing-time-display-mode: t
  emms-playing-time-mode: t
  company-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  global-subword-mode: t
  subword-mode: t
  auto-image-file-mode: t
  auto-insert-mode: t
  display-time-mode: t
  delete-selection-mode: t
  save-place-mode: t
  winner-mode: t
  which-key-mode: t
  wrap-region-global-mode: t
  wrap-region-mode: t
  helm-mode: t
  helm-adaptive-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-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
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/arthur/repos/emacs/lisp/transient hides /home/arthur/.emacs.d/elpa/transient-20210723.1601/transient
/home/arthur/.emacs.d/elpa/lispy-20210914.1209/elpa hides /home/arthur/.emacs.d/elpa/ivy-20210930.1450/elpa
/home/arthur/repos/emacs/lisp/emacs-lisp/helper hides /home/arthur/.emacs.d/elpa/helper-0.5/helper
/home/arthur/.emacs.d/lisp/helm-git-branch hides /home/arthur/.emacs.d/elpa/helm-git-branch-0.1/helm-git-branch
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-autoloads hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-autoloads
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-pkg hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-pkg
/home/arthur/.emacs.d/lisp/company-cmake hides /home/arthur/.emacs.d/elpa/company-20211002.1732/company-cmake

Features:
(shadow mail-extr helm-external helm-net ffap emacsbug sendmail gnus-topic
cursor-sensor nndraft nnmh nnfolder utf-7 gnutls network-stream gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015
mm-view mml-smime smime dig nntp gnus-cache gnus-sum shr kinsoku svg dom
gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo gnus-spec gnus-int gnus-range message yank-media rfc822 mml
mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader gnus-win tramp-archive tramp-gvfs tramp-cache zeroconf dbus
helm-command beacon emms-librefm-stream xml emms-librefm-scrobbler emms-i18n
emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks
emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd emms-lyrics emms-url
emms-streams emms-show-all emms-tag-editor emms-tag-tracktag emms-mark
emms-cache emms-info-native bindat emms-info-exiftool emms-info-tinytag
emms-info-metaflac emms-info-opusinfo emms-info-ogginfo emms-info-mp3info
emms-player-vlc emms-player-mplayer emms-player-mpv emms-mode-line-cycle
emms-mode-line emms-playing-time emms-player-simple emms-info emms-later-do
emms-playlist-limit emms-volume emms-volume-sndioctl emms-volume-mixerctl
emms-volume-pulse emms-volume-amixer emms-playlist-mode emms-source-playlist
emms-source-file locate emms-setup emms emms-compat c++-setup sv-kalender lunar
solar cal-dst holidays hol-loaddefs extras recentf tree-widget server overseer
pkg-info url-http url-auth url-gw nsm rmc puny epl f s outshine
outshine-org-cmds outorg org-protocol org-pdftools pdf-occur pdf-isearch
let-alist pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw mode-local cedet facemenu pdf-misc imenu pdf-tools
cus-edit cus-start cus-load pdf-view bookmark pp jka-compr pdf-cache pdf-info tq
pdf-util pdf-macs image-mode dired-extras dired-copy-paste dired-subtree
dired-hacks-utils openwith dired-x wdired dired-async dired-aux dired
dired-loaddefs exif org-noter org-element avl-tree org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob-core
ob-eval org-table oc-basic bibtex ol org-keys oc org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs noutline outline yasnippet-snippets
yasnippet derived disp-table page-break-lines company-yasnippet company-ispell
ispell company-clang company-elisp company-etags etags fileloop generator xref
project company-semantic company-template company-keywords company-files
company-capf company pcase comp comp-cstr warnings rx cl-extra elec-pair
autorevert hl-line cap-words superword subword image-file image-converter
autoinsert time delsel saveplace winner which-key advice solarized-dark-theme
solarized solarized-faces color wrap-region dash nnir gnus nnheader gnus-util
rmail rmail-loaddefs mail-utils wid-edit helm-mode helm-adaptive helm-projectile
projectile lisp-mnt mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr grep compile text-property-search ibuf-ext ibuffer ibuffer-loaddefs
thingatpt helm-eshell helm-elisp helm-files filenotify tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete comint
ansi-color parse-time iso8601 time-date ls-lisp helm-buffers helm-occur
helm-tags helm-locate helm-eval edebug backtrace find-func helm-info ring
helm-types helm-config diminish helm-pages helm-grep helm-regexp help-mode
helm-utils helm-help format-spec helm easy-mmode async-bytecomp
helm-global-bindings edmacro kmacro helm-source helm-multi-match helm-lib async
elisp-extras popup helm-easymenu cl info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip 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 cl-generic
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 simple abbrev obarray cl-preloaded nadvice button
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 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 646147 600209)
 (symbols 48 42638 423)
 (strings 32 149107 107480)
 (string-bytes 1 5524678)
 (vectors 16 73654)
 (vector-slots 8 1303521 923992)
 (floats 8 1181 2025)
 (intervals 56 2601 1886)
 (buffers 992 26))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 07:27:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50;
 Suggestion: refactor time.el into a more general 'clock' framework
Date: Thu, 02 Dec 2021 09:26:21 +0200
> From: Arthur Miller <arthur.miller <at> live.com>
> Date: Thu, 02 Dec 2021 00:08:37 +0100
> 
> My idea to per-use it is to simply run 'update-hooks' on clock beat, so any
> application can register a hook that will be called on a "clock beat". While it
> is maybe not so super-synchronized with system clock, it still gives impression
> of clocks in Emacs be synchronized.

Isn't that what timers are for?  Why can't you use run-with-timer for
what you want to do?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 08:30:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 02 Dec 2021 09:29:44 +0100
Arthur Miller <arthur.miller <at> live.com> writes:

> My idea to per-use it is to simply run 'update-hooks' on clock beat,
> so any application can register a hook that will be called on a "clock
> beat". While it is maybe not so super-synchronized with system clock,
> it still gives impression of clocks in Emacs be synchronized.

If I understand correctly, by "clock beat" you mean an integer multiple
of some time?  timer.el didn't support that well previously, but this
was fixed a few months ago (in 50765f3f) with TIME:

- or t (with non-nil REPEAT) meaning the next integral
  multiple of REPEAT.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 09:20:02 GMT) Full text and rfc822 format available.

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

From: Arthur Miller <arthur.miller <at> live.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 02 Dec 2021 10:19:37 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Arthur Miller <arthur.miller <at> live.com>
>> Date: Thu, 02 Dec 2021 00:08:37 +0100
>> 
>> My idea to per-use it is to simply run 'update-hooks' on clock beat, so any
>> application can register a hook that will be called on a "clock beat". While it
>> is maybe not so super-synchronized with system clock, it still gives impression
>> of clocks in Emacs be synchronized.
>
> Isn't that what timers are for?  Why can't you use run-with-timer for
> what you want to do?

Becaue it does not syncrhonize with clock that Emacs displays, if it displays. I
could use a timer, and I used it as mentioned in the description of suggestion.

As mentioned, not pretty, if different application will like to be notifed
at "11:30" clock time, and then one happends like half minut before the other.

Also there is no reason to create one timer per each application if all
application is want to be notified when certain clock time occur. It saves code
repetion that each application has to setup. Further, if user is displaying time
on the modeline, and those variables are all calculated, why should other
application re-define and re-calculate them.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 09:29:01 GMT) Full text and rfc822 format available.

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

From: Arthur Miller <arthur.miller <at> live.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 02 Dec 2021 10:28:01 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Arthur Miller <arthur.miller <at> live.com> writes:
>
>> My idea to per-use it is to simply run 'update-hooks' on clock beat,
>> so any application can register a hook that will be called on a "clock
>> beat". While it is maybe not so super-synchronized with system clock,
>> it still gives impression of clocks in Emacs be synchronized.
>
> If I understand correctly, by "clock beat" you mean an integer multiple
> of some time?
I am not sure if we speak about same thing; but I mean the clock, synchronized
with what Emacs shows as time.

Also there is no read to run several timers when one timer could
be fine to run several hooks as well as saving some code repetition.

> was fixed a few months ago (in 50765f3f) with TIME:
>
> - or t (with non-nil REPEAT) meaning the next integral
>   multiple of REPEAT.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 09:56:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 02 Dec 2021 10:55:20 +0100
Arthur Miller <arthur.miller <at> live.com> writes:

>> If I understand correctly, by "clock beat" you mean an integer multiple
>> of some time?
> I am not sure if we speak about same thing; but I mean the clock, synchronized
> with what Emacs shows as time.

I'm not sure either, because I'm not sure what you mean by
"synchronized".  But if you want a timer to run at 11:01:00, 11:02:00,
11:03:00, then timer.el has support for that (and calls that "integer
multiple").

> Also there is no read to run several timers when one timer could
> be fine to run several hooks as well as saving some code repetition.

Running several timers is fine.  And I don't think there's any code
repetition?  Just say

(run-at-time t 60 (lambda () (message (format-time-string "%H:%M:%S"))))

or whatever you want.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 09:56:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 02 Dec 2021 11:55:25 +0200
> From: Arthur Miller <arthur.miller <at> live.com>
> Cc: 52235 <at> debbugs.gnu.org
> Date: Thu, 02 Dec 2021 10:19:37 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Isn't that what timers are for?  Why can't you use run-with-timer for
> > what you want to do?
> 
> Becaue it does not syncrhonize with clock that Emacs displays, if it
> displays.

Because it doesn't synchronize with clock... what happens?

And what do you mean by "doesn't synchronize with clock that Emacs
displays"?  The time comes from the same source, so how can it be not
synchronized? in what sense?

> As mentioned, not pretty, if different application will like to be notifed
> at "11:30" clock time, and then one happends like half minut before the other.

Emacs cannot guarantee that the notification will happen exactly at
the requested time anyway.  This limitation is in effect both for
display-time-mode and for timers, and for exactly the same reasons.

> Also there is no reason to create one timer per each application if all
> application is want to be notified when certain clock time occur.

So create a single timer that applications could register to.

> Further, if user is displaying time
> on the modeline, and those variables are all calculated, why should other
> application re-define and re-calculate them.

Because the way users customize time display on the mode line doesn't
necessarily fits the needs of an arbitrary other application which
wants to be notified at some time.  For example, users can control the
frequency and the resolution of the time display, and their
preferences for that can be correct for some other application only by
sheer luck.

My point is that I don't see why this feature has to touch
display-time-mode.  That is not clean, IMO.  It should be a separate
feature that uses timers.  The feature could create a timer the first
time it is requested, and then any additional clients could reuse the
same timer.  Of course, if you want to use a single timer, you'd still
need to solve the potentially different needs of each application: for
example, one of them may wish to be notified each second, the other
each hour.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 23:37:02 GMT) Full text and rfc822 format available.

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

From: Arthur Miller <arthur.miller <at> live.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Fri, 03 Dec 2021 00:36:37 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Arthur Miller <arthur.miller <at> live.com> writes:
>
>>> If I understand correctly, by "clock beat" you mean an integer multiple
>>> of some time?
>> I am not sure if we speak about same thing; but I mean the clock, synchronized
>> with what Emacs shows as time.
>
> I'm not sure either, because I'm not sure what you mean by
> "synchronized".  But if you want a timer to run at 11:01:00, 11:02:00,
> 11:03:00, then timer.el has support for that (and calls that "integer
> multiple").

Ok. I have tried it now; it seems to work :). TBH I didn't realize what "integer
multiple of REPEAT" means in this aspect, so I didn't even use 't option, and I
also wanted it to start immidiately so I thought I wanted 'nil = meaning now
option. I don't know, blame it on my english, but I found that one tricky to
understand doc.

I don't know if I can suggest better wording myself, but maybe it might help
someone else one day, if that last option was reworded somehow. I think people
usually use term "wall clcok" in this context, but I am not sure, I am not
native english speaker, but I think I have encountered that term in std c++ docs
and Java docs.

>> Also there is no read to run several timers when one timer could
>> be fine to run several hooks as well as saving some code repetition.
>
> Running several timers is fine.  And I don't think there's any code
> repetition?  Just say
>
> (run-at-time t 60 (lambda () (message (format-time-string "%H:%M:%S"))))
>
> or whatever you want.

I guess timers are not very expensive resource in a system, no idea actually how
memory/cpu costly (or cheaply) they are, but it is just that I have to
keep track of it to cancel it when I am done to not leak resource.

By now I am also used to "hooks" in Emacs, and Emacs acting as a framework in
many cases, so it kind of suits my mental build better to add a function to a
hook and get it called than have to setup this manually.

Anyway, this was a suggestion and thanks for the clarification about integer
multiple in this context :-).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Thu, 02 Dec 2021 23:49:01 GMT) Full text and rfc822 format available.

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

From: Arthur Miller <arthur.miller <at> live.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Fri, 03 Dec 2021 00:48:05 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Because it doesn't synchronize with clock... what happens?
>
> And what do you mean by "doesn't synchronize with clock that Emacs
> displays"?  The time comes from the same source, so how can it be not
> synchronized? in what sense?

Lars clarified about that. What I meant was what "wall clock" usually mean in
this context; I didn't understand that "integer multiple of REPEAT" (as in docs)
meant actually that.

> My point is that I don't see why this feature has to touch
> display-time-mode.  That is not clean, IMO.  It should be a separate
> feature that uses timers.  The feature could create a timer the first
> time it is requested, and then any additional clients could reuse the
> same timer.  Of course, if you want to use a single timer, you'd still
> need to solve the potentially different needs of each application: for
> example, one of them may wish to be notified each second, the other
> each hour.
Indeed, you are correct about that one. I am a bit used to Emacs "hook"
frameworking, so I just wanted to have a hook to add somewhere and get my clock
going :).

But yes, you are right, one clock might wish to display seconds while
another one only minutes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Fri, 03 Dec 2021 00:53:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52235 <at> debbugs.gnu.org, Arthur Miller <arthur.miller <at> live.com>
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Thu, 2 Dec 2021 16:52:16 -0800
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm not sure either, because I'm not sure what you mean by
> "synchronized".  But if you want a timer to run at 11:01:00, 11:02:00,
> 11:03:00, then timer.el has support for that (and calls that "integer
> multiple").

Do you mean this part?

    - or t (with non-nil REPEAT) meaning the next integral
      multiple of REPEAT.

Shouldn't that be "integer" multiple?  From searching online it seems
like you can use them interchangeably in math (I think?), but presumably
most of us here are more programmers than mathematicians and so might
prefer the more mundane word here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Fri, 03 Dec 2021 07:27:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: larsi <at> gnus.org, 52235 <at> debbugs.gnu.org, arthur.miller <at> live.com
Subject: Re: bug#52235: 29.0.50;
 Suggestion: refactor time.el into a more general 'clock' framework
Date: Fri, 03 Dec 2021 09:26:33 +0200
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Thu, 2 Dec 2021 16:52:16 -0800
> Cc: Arthur Miller <arthur.miller <at> live.com>, 52235 <at> debbugs.gnu.org
> 
>     - or t (with non-nil REPEAT) meaning the next integral
>       multiple of REPEAT.
> 
> Shouldn't that be "integer" multiple?

No, "integral" is correct here.  "Integer multiple" is actually a
subtle mistake.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52235; Package emacs. (Fri, 03 Dec 2021 16:25:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52235 <at> debbugs.gnu.org
Subject: Re: bug#52235: 29.0.50; Suggestion: refactor time.el into a more
 general 'clock' framework
Date: Fri, 03 Dec 2021 17:23:59 +0100
Arthur Miller <arthur.miller <at> live.com> writes:

> Ok. I have tried it now; it seems to work :). TBH I didn't realize
> what "integer multiple of REPEAT" means in this aspect, so I didn't
> even use 't option, and I also wanted it to start immidiately so I
> thought I wanted 'nil = meaning now option. I don't know, blame it on
> my english, but I found that one tricky to understand doc.

Yes, the documentation is rather gnomic here.  I've now expanded this
bit in both the doc string and the manual so that it should be easier to
understand.

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




bug marked as fixed in version 29.1, send any further explanations to 52235 <at> debbugs.gnu.org and Arthur Miller <arthur.miller <at> live.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 03 Dec 2021 16:25:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 01 Jan 2022 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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