Subject: bug#79253: Add timestamps to *Messages*

From: "R. Diez" <[email-masked]>
Date: Mon, 18 Aug 2025 17:06:42 +0200

>> That looks like a wrong API design to me. The *Message* buffer is obviously line-oriented. If someone makes multiple calls to message_dolog() in order to create a single text line, then somebody else calling message_dolog() or 'message' between those calls will break that line.
> 
> The Emacs Lisp machine is single-threaded, so such a "somebody else"
> doesn't exist who could interfere between consecutive calls to
> message_dolog.

This API problem is not limited to multithreaded scenarios. I actually had the same issue a few years ago outside Emacs in a single-threaded firmware. I added a trace() call to some routine without realising that the caller was calling it between 2 other trace() calls, which broke up the caller's log line.

If Emacs is really only calling message_dolog() consecutively, it should be easy to merge them into a single call (I would imagine).

> Not if there are different logics that determine each piece of text.
> (And inserting text is usually very light-weight anyway.  It must be,
> for Emacs to be an efficient editor.)
> [...]

I just realised it does not really make sense for me to pursue this feature any longer.

I haven't really got the time, or the necessary Emacs knowledge and skills. Even if you implemented exactly what I have in mind, you will probably ask me to test it, and I may not have the time or be able to write the necessary Lisp code to take advantage of the new hooks.

I said for example that I would pipe the messages to syslog and then use standard syslog tools, but to do that, I would have to figure out how to run a background process from Emacs, open a pipe to it, monitor its health, etc.

So I think it is best if I just stop it before I make you write any code or devote any more time to this. I hope the information in this bug report could at least save someone else some time in the future. And I learnt something new today: there is a desktop-save-mode which will save my *Messages* buffer across sessions.

Thanks for the information,
   rdiez