Skip to main content
14 votes
Accepted

How to add a timestamp to each entry in Emacs' *Messages* buffer?

I have the following snippet in my init.el, which was adapted from an original I found in the following Reddit thread: http://www.reddit.com/r/emacs/comments/16tzu9/...
Stuart Hickinbottom's user avatar
9 votes
Accepted

Prevent Emacs from messaging when it writes recentf

One solution for that narrow case is to dynamically set save-silently for that invocation specific invocation. Try: (run-at-time nil (* 5 60) (lambda () (let ((save-...
ebpa's user avatar
  • 7,579
9 votes

How to add a timestamp to each entry in Emacs' *Messages* buffer?

The translation of @xinfatang's simple solution to the new advice-add syntax as a wrapper around the message function is: (defun my-message-with-timestamp (old-func fmt-string &rest args) "...
mithos's user avatar
  • 91
8 votes
Accepted

How do I suppress messages in the echo area (e.g. `Fill column set to 80 (was 80)`)?

@NickD answered the question well. But you can also do this, just to inhibit showing messages for set-fill-column: (add-hook 'python-mode-hook (lambda () (setq indent-tabs-mode ...
Drew's user avatar
  • 79.1k
7 votes
Accepted

Inspect message output

M-x view-echo-area-messages RET or C-h e will open the *Messages* buffer. (This buffer can even contain some stuff that's not shown in the minibuffer, see inhibit-message.)
unhammer's user avatar
  • 1,231
6 votes
Accepted

Disabling the "Auto-saving...done" message

Is there a way to just disable this message, but not the auto-saving functionality? Yes, Emacs 27 will introduce the user option auto-save-no-message: auto-save-no-message is a variable defined in ‘...
Basil's user avatar
  • 12.6k
6 votes

How to add a timestamp to each entry in Emacs' *Messages* buffer?

Refer to https://www.emacswiki.org/emacs/DebugMessages: (defadvice message (before when-was-that activate) "Add timestamps to `message' output." (ad-set-arg 0 (...
xinfa tang's user avatar
6 votes
Accepted

Is there a way to read the current displayed message?

Take a look at current-message function: (current-message) Probably introduced at or before Emacs version 20. Return the string currently displayed in the echo area, or nil if none. Code (progn (...
muffinmad's user avatar
  • 2,340
6 votes
Accepted

How to suppress `When done with a buffer, type C-x #` warning message?

The only way to avoid that message with Emacs earlier than 28.1 is to invoke emacsclient with the -n (--nowait) option. Starting with Emacs 28.1 (basically, current upstream at the time of writing), ...
NickD's user avatar
  • 33.6k
5 votes
Accepted

Is it possible suppress save message for undo-tree?

undo-tree-save-history calls write-region. In this example, we suppress the Wrote ... message entirely using an :around advice. Here are the steps used to verify the answer works as advertised: STEP ...
lawlist's user avatar
  • 19.5k
5 votes
Accepted

How can I suppress the message `When done with this frame, type C-x 5 0`?

This is possible starting from Emacs 28, which provides the user option server-client-instructions for this purpose. (setq server-client-instructions nil)
phils's user avatar
  • 53k
5 votes
Accepted

How to suppress `Wrote /home/user/.emacs.d/recentf` message in minibuffer

This should do it. (defun no-msg (function) "Prevent FUNCTION from showing `Wrote <FILE>' messages. \(The messages are still logged to `*Messages*'.)" (let ((inhibit-message t)) ...
Drew's user avatar
  • 79.1k
4 votes

How to add a locally override the message function?

This macro adds support for adding a suffix to messages. Using advice allows this to be nested, so multiple functions can add their own suffixes which accumulate onto the end. (defmacro with-temp-...
ideasman42's user avatar
  • 9,157
4 votes

Percentage sign in `print` and `message`

By running (message (format ...)), you're using the string as a format twice. print takes an object as its parameter, while message takes a format string. Use "%s" as the format and you can ...
choroba's user avatar
  • 2,125
3 votes
Accepted

how to read messages which appear after `C-x C-c`?

When killing Emacs, there are several hooks that may end up being called -- including, but not limited to, kill-emacs-hook, kill-buffer-hook (when a buffer is killed), write-file-functions hook (if a ...
lawlist's user avatar
  • 19.5k
3 votes
Accepted

How to show a message in the echo area not immediately but after a certain delay and to disappear it after a certain delay

You could try something like: (run-with-timer 2 nil (lambda () (message "Some message") (run-with-timer 3 nil (lambda () (message nil)...
Stuart Hickinbottom's user avatar
3 votes

Suppress message in minibuffer when a buffer is saved?

There is a var named save-silently in files.el. if you set the var to t I think the message will not show again. (defvar save-silently nil "If non-nil, avoid messages when saving files. Error-...
carlos's user avatar
  • 161
3 votes
Accepted

Suppress message in minibuffer when a buffer is saved?

You can use following (defmacro with-suppressed-message (&rest body) "Suppress new messages temporarily in the echo area and the `*Messages*' buffer while BODY is evaluated." (declare (indent ...
Haruyasu Ueda's user avatar
3 votes
Accepted

When working on elisp where to show intermediate values?

If you are using messages to yourself while developing then: That's fine - nothing wrong with using message. You can also define a wrapper for such uses of message, which respects a global variable ...
Drew's user avatar
  • 79.1k
3 votes
Accepted

Is it possible to suppress `LSP :: Connected to [pyls:N].` message on minibuffer?

(defun disable-lsp-conn-msg-advice (func &rest r) (unless (string-prefix-p "Connected to" (car r)) (apply func r))) (advice-add 'lsp--info :around #'disable-lsp-conn-msg-advice)
TerryTsao's user avatar
  • 1,236
3 votes

How do I suppress messages in the echo area (e.g. `Fill column set to 80 (was 80)`)?

Regarding the specific example case... set-fill-column is a command which is only intended to be used interactively. To set the fill column programmatically, just do this: (setq fill-column 80) Which ...
phils's user avatar
  • 53k
2 votes
Accepted

Hook that fires when `*Messages*` is updated

I think you'd need to use polling, sadly. Detecting via polling that a change happened isn't very hard. Detecting which change happened would in general require keeping a copy of the buffer's ...
Stefan's user avatar
  • 26.7k
2 votes

Taking action depending on the presence of particular message in the echo area

I don't know what you want to accomplish exactly, but as other people pointed out, reading the echo area is not the best strategy. Instead, you probably want to set up a sentinel. Many commands in ...
giordano's user avatar
  • 3,265
2 votes

How to add a timestamp to each entry in Emacs' *Messages* buffer?

My solution expands on Stuart Hickinbottom 's and xinfa tang 's answers by NOT printing the timestamp of repeated messages: (defvar my-package--last-message nil "Last message with timestamp ...
coffeepenbit's user avatar
2 votes

Persistent message in the echo area?

I tried the following. It seems to work, but I'm not sure about edge cases, and I'm still testing. The following code displays "foo" in the echo area, and then "bar", and then "hippo", and then "oink"....
HippoMan's user avatar
  • 646
2 votes
Accepted

Prevent showing buffer reversion message while working in the minibuffer

I think you could add something like this to your initialization: (advice-add 'auto-revert-handler :around (lambda (orig-fun &rest args) (let ((auto-revert-verbose (not (minibufferp (...
Gina White's user avatar
2 votes

Prevent showing buffer reversion message while working in the minibuffer

You most probably have set the global autorevert mode on using this form: (global-auto-revert-mode) You can stop it sending messages to minibuffer by setting (setq auto-revert-verbose nil) Set it ...
Heikki's user avatar
  • 3,096
2 votes
Accepted

Inhibiting `finished:` message from `async-shell-command`

There are two versions of function (inhibit-sentinel-messages FUN &rest ARGS) defined in Section Code of inhibit-sentinel-messages of this answer. The first version wraps all sentinels started in ...
Tobias's user avatar
  • 33.7k
2 votes
Accepted

Is there a way to keep the *Messages* buffer scrolled to the bottom?

Just place the cursor/point at the end of the *Messages* buffer (e.g. using M->). If you keep it there, the message buffer will stay 'scrolled down'.
dalanicolai's user avatar
  • 7,985
2 votes

How to capture a function's `message` output?

Since it calls kill-new to insert the link into the kill-ring, you could just call current-kill to retrieve it.
db48x's user avatar
  • 19.1k

Only top scored, non community-wiki answers of a minimum length are eligible