Subject: bug#55163: 29.0.50; master 4a1f69ebca (TICKS . HZ) for current-time broke lsp-mode

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 29 Apr 2022 11:54:07 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Thanks; makes sense to me.  And it was worth a try to modernise these
> functions, but it doesn't seem like the world is ready yet (and it's
> hard to see a practical way forward without deprecating all the current
> time-related functions and creating new ones, which we probably don't
> want to do).

Thinking about this slightly more, perhaps it's worth doing?  Because we
currently have some interfaces in this area that could be more efficient
or elegant.

The time functions commonly used are don't have particularly
discoverable names -- current-time and float-time are probably the ones
used most.  Another common source of times are
(file-attribute-modification-time (file-attributes ...)), which is
commonly called in loops, and generates a lot of unnecessary garbage.

So perhaps we could come up with a set of new functions in this area
that are more efficient and avoid using the old time formats.

Off the top of my head, we could have
(file-attribute file 'modification-time) (i.e., have a &rest to specify
the attributes, and don't return a list if there's one attribute, which
is common).  And we could have `time' instead of `current-time', with
(time 'float) instead of `float-time' and even (time 'decoded) instead
of `decode-time'.  Or `time-float', `time-decoded' with no parameters...

And so on.  That is, I think this might be an opportunity to overhaul
Emacs in this area -- introduce efficient functions with consistent
naming, and then obsolete the old ones after a while.

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