GNU bug report logs -
#79253
Add timestamps to *Messages*
Previous Next
To reply to this bug, email your comments to 79253 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sat, 16 Aug 2025 07:38:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"R. Diez" <rdiez-2006 <at> rd10.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 16 Aug 2025 07:38:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi all:
I am trying to debug a Tramp problem, and I need associate Tramp debug log entries with entries in the *Messages* buffer.
This is hard to do, because the *Messages* buffer has no timestamps.
Some other people have had this problem before:
https://emacs.stackexchange.com/questions/32150/how-to-add-a-timestamp-to-each-entry-in-emacs-messages-buffer
The trouble is, there is not one solution, but a few of them, with different activation procedures. I gets complicated because minibuffer vs *Messages*, and because of the "[3 times]" markers upon repetition.
I am not very proficient at Lisp, and I couldn't make it out. The "advice" method is a kludge anyway.
Could you implement an easy way to add timestamps to the *Messages* buffer?
Thanks in advance,
rdiez
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sat, 16 Aug 2025 07:45:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
"R. Diez" via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:
> Hi all:
Hi,
> I am trying to debug a Tramp problem, and I need associate Tramp debug log entries with entries in the *Messages* buffer.
>
> This is hard to do, because the *Messages* buffer has no timestamps.
>
> Some other people have had this problem before:
>
> https://emacs.stackexchange.com/questions/32150/how-to-add-a-timestamp-to-each-entry-in-emacs-messages-buffer
>
> The trouble is, there is not one solution, but a few of them, with different activation procedures. I gets complicated because minibuffer vs *Messages*, and because of the "[3 times]" markers upon repetition.
>
> I am not very proficient at Lisp, and I couldn't make it out. The "advice" method is a kludge anyway.
>
> Could you implement an easy way to add timestamps to the *Messages* buffer?
What is wrong with Tramp's debug buffers? They provide timestamps.
Personally, I don't believe we shall add such a general "improvement" to
the *Messages* buffer. It is a simple mean to show messages sent to
it. The contents of a message, including a timestamp, is the
responsibility of the sender.
But that's my understanding; people might see it different.
> Thanks in advance,
> rdiez
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sat, 16 Aug 2025 07:45:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sat, 16 Aug 2025 09:21:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 15 Aug 2025 21:40:39 +0200
> From: "R. Diez" via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Hi all:
>
> I am trying to debug a Tramp problem, and I need associate Tramp debug log entries with entries in the *Messages* buffer.
>
> This is hard to do, because the *Messages* buffer has no timestamps.
>
> Some other people have had this problem before:
>
> https://emacs.stackexchange.com/questions/32150/how-to-add-a-timestamp-to-each-entry-in-emacs-messages-buffer
>
> The trouble is, there is not one solution, but a few of them, with different activation procedures. I gets complicated because minibuffer vs *Messages*, and because of the "[3 times]" markers upon repetition.
>
> I am not very proficient at Lisp, and I couldn't make it out. The "advice" method is a kludge anyway.
>
> Could you implement an easy way to add timestamps to the *Messages* buffer?
Did you try using set-message-function to install your function as the
one that adds a time stamp to the text of the message to be shown? If
you tried, and it didn't work, please tell what didn't work. If you
didn't try, please do.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 06:28:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> What is wrong with Tramp's debug buffers? They provide timestamps.
I suspect that some Tramp connection timeout messages only appear in the *Messages* buffer, and not in Tramp's debugger buffer, or they appear with a long delay. That is why I wanted to correlate.
In any case, I should have phrased this feature request differently. It is not about Tramp, it is a general feature request for *Messages* which could help in other scenarios, like correlating Emacs events with external logs, or just checking how much time has passed between 2 messages in that buffer, or how long ago some event I am trying to troubleshoot happened.
> Personally, I don't believe we shall add such a general "improvement" to
> the *Messages* buffer. It is a simple mean to show messages sent to
> it. The contents of a message, including a timestamp, is the
> responsibility of the sender.
I have a different opinion. 8-)
It is impractical for the sender to add timestamps. There are thousands of senders. And how are they going to agree the time format?
Other log systems or log windows add the timestamps automatically. In the command line, I can use a tool like 'ts' from moreutils in order to prepend a timestamp to every line of input you give it. But that wouldn't work with the *Messages* buffer.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 06:28:04 GMT)
Full text and
rfc822 format available.
Message #20 received at 79253 <at> debbugs.gnu.org (full text, mbox):
>> Could you implement an easy way to add timestamps to the *Messages* buffer?
>
> Did you try using set-message-function to install your function as the
> one that adds a time stamp to the text of the message to be shown? If
> you tried, and it didn't work, please tell what didn't work. If you
> didn't try, please do.
First of all, thanks for the hint. The 'message' function does not mention 'set-message-function' or the like, so I missed it.
I could find very little information about 'set-message-function', and no examples whatsoever, so I came up with this:
(defun my-message-function (msg)
"" ; No docstring yet.
(concat "Test: " msg))
(setq set-message-function #'my-message-function)
The effect is that messages in the minibuffer do get the "Test:" prefix, but messages in the *Messages* buffer do not.
But that is exactly the opposite of what I am trying to achieve!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 06:45:02 GMT)
Full text and
rfc822 format available.
Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):
"R. Diez" via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:
Hi,
>> What is wrong with Tramp's debug buffers? They provide timestamps.
>
> I suspect that some Tramp connection timeout messages only appear in
> the *Messages* buffer, and not in Tramp's debugger buffer, or they
> appear with a long delay. That is why I wanted to correlate.
FTR: any message from Tramp sent to *Messages* is also sent to the
respective Tramp debug buffer, if such buffer is in place. It is
created, when tramp-verbose is greater than 3. All of this is explained
in (info "(tramp) Traces and Profiles") .
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 06:45:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 06:54:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 79253 <at> debbugs.gnu.org (full text, mbox):
severity 79253 wishlist
thanks
> Date: Sat, 16 Aug 2025 23:01:50 +0200
> Cc: 79253 <at> debbugs.gnu.org
> From: "R. Diez" <rdiez-2006 <at> rd10.de>
>
>
> >> Could you implement an easy way to add timestamps to the *Messages* buffer?
> >
> > Did you try using set-message-function to install your function as the
> > one that adds a time stamp to the text of the message to be shown? If
> > you tried, and it didn't work, please tell what didn't work. If you
> > didn't try, please do.
>
> First of all, thanks for the hint. The 'message' function does not mention 'set-message-function' or the like, so I missed it.
>
> I could find very little information about 'set-message-function', and no examples whatsoever, so I came up with this:
>
> (defun my-message-function (msg)
> "" ; No docstring yet.
> (concat "Test: " msg))
>
> (setq set-message-function #'my-message-function)
>
> The effect is that messages in the minibuffer do get the "Test:" prefix, but messages in the *Messages* buffer do not.
>
> But that is exactly the opposite of what I am trying to achieve!
OK, thanks for testing.
One problem with your request is that Emacs many times generates
messages by multiple calls to the 'message' function. Prepending the
current time to each message passed to 'message' will thus produce
somewhat sub-optimal, maybe even ugly, results. For example, if you
type C-p at the first line of a buffer, Emacs signals an error that
logs in the *Messages* buffer as
previous-line: Beginning of buffer
But if we prepend each logged message with current time, it will
instead look like this:
17/08/2025 00:09:44 previous-line
17/08/2025 00:09:44 :
17/08/2025 00:09:44 Beginning of buffer
This happens because in this case we call 'message' 3 times, with the
following 3 strings:
"previous-line"
": "
"Beginning of buffer"
If this is acceptable, we can implement the feature you are asking
for. Otherwise, I don't see how this could be implemented, except by
having each Lisp program that calls 'message' inject the time string
where appropriate.
What do people think about the acceptability of the above?
Do people have other ideas for implementing this?
Severity set to 'wishlist' from 'normal'
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 17 Aug 2025 06:54:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 07:13:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 79253 <at> debbugs.gnu.org (full text, mbox):
severity 79253 wishlist
thanks
> Date: Sat, 16 Aug 2025 23:01:50 +0200
> Cc: 79253 <at> debbugs.gnu.org
> From: "R. Diez" <rdiez-2006 <at> rd10.de>
>
>
> >> Could you implement an easy way to add timestamps to the *Messages* buffer?
> >
> > Did you try using set-message-function to install your function as the
> > one that adds a time stamp to the text of the message to be shown? If
> > you tried, and it didn't work, please tell what didn't work. If you
> > didn't try, please do.
>
> First of all, thanks for the hint. The 'message' function does not mention 'set-message-function' or the like, so I missed it.
>
> I could find very little information about 'set-message-function', and no examples whatsoever, so I came up with this:
>
> (defun my-message-function (msg)
> "" ; No docstring yet.
> (concat "Test: " msg))
>
> (setq set-message-function #'my-message-function)
>
> The effect is that messages in the minibuffer do get the "Test:" prefix, but messages in the *Messages* buffer do not.
>
> But that is exactly the opposite of what I am trying to achieve!
OK, thanks for testing.
One problem with your request is that Emacs many times generates
messages by multiple calls to the 'message' function. Prepending the
current time to each message passed to 'message' will thus produce
somewhat sub-optimal, maybe even ugly, results. For example, if you
type C-p at the first line of a buffer, Emacs signals an error that
logs in the *Messages* buffer as
previous-line: Beginning of buffer
But if we prepend each logged message with current time, it will
instead look like this:
17/08/2025 00:09:44 previous-line
17/08/2025 00:09:44 :
17/08/2025 00:09:44 Beginning of buffer
This happens because in this case we call 'message' 3 times, with the
following 3 strings:
"previous-line"
": "
"Beginning of buffer"
It also means that the usual Emacs feature of compacting *Messages* by
combining duplicate messages will not work, because each of those
duplicate lines will now have different time stamps prepended to it,
and also potentially broken into several lines.
If this is acceptable, we can implement the feature you are asking
for. Otherwise, I don't see how this could be implemented, except by
having each Lisp program that calls 'message' inject the time string
where appropriate.
What do people think about the acceptability of the above?
Do people have other ideas for implementing this?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 12:45:04 GMT)
Full text and
rfc822 format available.
Message #37 received at 79253 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> This happens because in this case we call 'message' 3 times, with the
> following 3 strings:
>
> "previous-line"
> ": "
> "Beginning of buffer"
Not the OP, I would like to understand more.
I have just evaluated
(progn (message "previous-line")
(message ": ")
(message "Beginning of buffer"))
and I see 3 separate messages in the *Messages* buffer:
previous-line
:
Beginning of buffer
Why were they not concatenated as you had described?
> What do people think about the acceptability of the above?
> Do people have other ideas for implementing this?
Seeing "previous-line: Beginning of buffer" as 3 messages is not
acceptable, IMHO.
P.S.
Not to derail the bug report, but speaking the *Messages* buffer
improvements, I would also like to see automatic scrolling, along with
two new key bindings, one for adding some sort of separator and another
for clearing the buffer. I mention these ideas here in the case they
somehow tie to the missing time stamps design-wise.
Rudy
--
"The introduction of suitable abstractions is our only mental aid to
organize and master complexity." --- Edsger Wybe Dijkstra, 1930-2002
Rudolf Adamkovič <rudolf <at> adamkovic.org> [he/him]
http://adamkovic.org
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 13:03:01 GMT)
Full text and
rfc822 format available.
Message #40 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> From: Rudolf Adamkovič <rudolf <at> adamkovic.org>
> Cc: 79253 <at> debbugs.gnu.org
> Date: Sun, 17 Aug 2025 14:44:13 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > This happens because in this case we call 'message' 3 times, with the
> > following 3 strings:
> >
> > "previous-line"
> > ": "
> > "Beginning of buffer"
>
> Not the OP, I would like to understand more.
>
> I have just evaluated
>
> (progn (message "previous-line")
> (message ": ")
> (message "Beginning of buffer"))
>
> and I see 3 separate messages in the *Messages* buffer:
>
> previous-line
> :
> Beginning of buffer
>
> Why were they not concatenated as you had described?
Because that's not what Emacs does in that case (I've simplified this
in my explanation). If you want to see all the details, put a
breakpoint in message_dolog and then trigger the error message.
> Not to derail the bug report, but speaking the *Messages* buffer
> improvements, I would also like to see automatic scrolling, along with
> two new key bindings, one for adding some sort of separator and another
> for clearing the buffer. I mention these ideas here in the case they
> somehow tie to the missing time stamps design-wise.
Automatic scrolling already exists. As for the rest, feel free to
propose new features (just not as part of this bug report).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Sun, 17 Aug 2025 18:05:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> [...]
> 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.
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()?
> I would also like to see automatic scrolling,
Automatic scrolling works for me.
> 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.
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 thought of piping all *Messages* lines to syslog, but I couldn't find a hook to do that. If I could do it, I wouldn't need timestamps, because syslog would take care of that automatically. By the way, that would require whole-line additions too.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 02:46:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 79253 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I am trying to debug a Tramp problem, and I need associate Tramp debug
> log entries with entries in the *Messages* buffer.
Ordinary Emacs editing is sequential and only the order matters.
For people like me, whi do that, timestamps would be unhelpful clutter.
So if we implement timestamps, there should be an easy way to turn them off.
Or an easy way to specify which messages should have timestamps.
Perhaps with a list of regexps that gives timestamps to a message
if it matches any of those regexps.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 06:51:01 GMT)
Full text and
rfc822 format available.
Message #49 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> Ordinary Emacs editing is sequential and only the order matters.
> For people like me, whi do that, timestamps would be unhelpful clutter.
> So if we implement timestamps, there should be an easy way to turn them off.
When I switch to a *Compile-Log* buffer, I get an extra menu at the top called "Compile", with options like "Next Error" and "Stop Compilation".
Wouldn't it be cool if the *Messages* buffer also displayed a new menu with options like "Show Timestamps", "Show Time Deltas" and "Clear Buffer"?
But I am now more inclined to just offer a hook to capture the text lines sent to the *Messages* buffer. This way, you have complete freedom: you can send the text lines to syslog and/or implement your own *Enhanced Messages* buffer with all those features. I'm sure somebody would then write an Emacs package with such functionality. After the hook, the only other thing probably missing is to change all internal callers so that they write whole lines in a go.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 11:02:01 GMT)
Full text and
rfc822 format available.
Message #52 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 11:34:01 GMT)
Full text and
rfc822 format available.
Message #55 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> Cc: 79253 <at> debbugs.gnu.org
> From: Richard Stallman <rms <at> gnu.org>
> Date: Sun, 17 Aug 2025 22:45:46 -0400
>
> > I am trying to debug a Tramp problem, and I need associate Tramp debug
> > log entries with entries in the *Messages* buffer.
>
> Ordinary Emacs editing is sequential and only the order matters.
> For people like me, whi do that, timestamps would be unhelpful clutter.
> So if we implement timestamps, there should be an easy way to turn them off.
They will be opt-in, of course, if we decide to implement this.
> Or an easy way to specify which messages should have timestamps.
> Perhaps with a list of regexps that gives timestamps to a message
> if it matches any of those regexps.
That could be an idea, but I'm afraid that predicting the important
messages in advance is difficult to say the least. So there's a
significant chance the important ones will be missed. For a debugging
aid, this is a significant disadvantage, IME. It's like debugging
with GDB with a breakpoint randomly succeeding and failing to stop the
program.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 11:40:02 GMT)
Full text and
rfc822 format available.
Message #58 received at 79253 <at> debbugs.gnu.org (full text, mbox):
> Cc: 79253 <at> debbugs.gnu.org
> Date: Mon, 18 Aug 2025 08:49:55 +0200
> From: "R. Diez" via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> > Ordinary Emacs editing is sequential and only the order matters.
> > For people like me, whi do that, timestamps would be unhelpful clutter.
> > So if we implement timestamps, there should be an easy way to turn them off.
>
> When I switch to a *Compile-Log* buffer, I get an extra menu at the top called "Compile", with options like "Next Error" and "Stop Compilation".
>
> Wouldn't it be cool if the *Messages* buffer also displayed a new menu with options like "Show Timestamps", "Show Time Deltas" and "Clear Buffer"?
See my earlier reply: the *Messages* buffer is put under a special
major mode, so that mode could define menus that are useful in that
buffer. Patches welcome.
> But I am now more inclined to just offer a hook to capture the text lines sent to the *Messages* buffer. This way, you have complete freedom: you can send the text lines to syslog and/or implement your own *Enhanced Messages* buffer with all those features. I'm sure somebody would then write an Emacs package with such functionality. After the hook, the only other thing probably missing is to change all internal callers so that they write whole lines in a go.
I don't think a hook is necessary. You could write a special minor
mode, whereby a timer would periodically copy the contents of the
*Messages* buffer to a file or a system log or whatever.
(Having hooks for inserting text into *Messages* is hard technically
because we deliberately use low-level functions to do that, to avoid
any such hooks, because hooks could be unsafe to run, and having such
a hook signal an error while storing messages into *Messages* might
render Emacs unusable.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79253
; Package
emacs
.
(Mon, 18 Aug 2025 15:07:02 GMT)
Full text and
rfc822 format available.
Message #61 received at 79253 <at> debbugs.gnu.org (full text, mbox):
>> 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
This bug report was last modified 24 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.