GNU bug report logs -
#79253
Add timestamps to *Messages*
Previous Next
Full log
View this message in rfc822 format
> Date: Sun, 17 Aug 2025 20:04:04 +0200
> Cc: 79253 <at> debbugs.gnu.org, Rudolf Adamkovič
> <rudolf <at> adamkovic.org>
> From: "R. Diez" <rdiez-2006 <at> rd10.de>
>
>
> > [...]
> > This happens because in this case we call 'message' 3 times, with the
> > following 3 strings:
> >
> > "previous-line"
> > ": "
> > "Beginning of buffer"
>
> 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.
> I do not know anything about Emacs' internals, but I would imagine that inserting text in a buffer carries some overhead. Wouldn't it be more efficient anyway if the caller pieced together the complete line before calling message_dolog()?
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.)
> > along with two new key bindings, one for adding some sort of separator and another for clearing the buffer.
>
> I have also missed a way to clear the *Messages* buffer, or to add a separator, in order to know if a text line came after the latest change I made in my code.
>
> In fact, I have written a tool to automatically add a separator when a log pause is detected in the console:
>
> https://github.com/rdiez/Tools/tree/master/LogPauseDetector
>
> But it is hard to implement such things in Emacs, because there are no hooks for the 'message' function.
This is unrelated to 'message'. The *Messages* buffer is under a
special major mode, messages-buffer-mode, so we can customize the
behavior in that buffer as we do in other cases.
> One thing that has always bothered me is that Emacs does not persist the *Messages* buffer. Because I am pretty bad at Lisp, sometimes my code fails under some weird circumstances. Or somebody else's code, like the recent trouble with Tramp's session timeouts. I then wanted to check whether I have gotten a particular message in the past, and what messages were around it, but the contents of *Messages* gets lost between reboots.
I suggest to try using desktop-save-mode to save *Messages* between
sessions.
Anyway, these feature requests are out of scope of this bug report,
and should be raised separately.
What was important for me in this bug report was to hear opinions
about the fact that some messages will broken into several lines if we
add time-stamping at the message_dolog level. I don't think you have
voiced your opinion about it -- would you please voice it?
This bug report was last modified 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.