You could colorize the message in the minibuffer with

    (message (propertize "foo bar" 'face '(:foreground "green" :weight bold)))

I would apply this only to the confirmation message of writings. The green color will help me to clearly distinct errors and confirmations from the minibuffer.

However, the confirmation message is different every time. So the confirmation message in the minibuffer could be like :

Wrote C:/foo.el


Wrote C:/bar.el

When searching around on Emacs Stackexchange, there are various ways to surpress or display another message. But they assume it's a static string message. It's not. The message differs each time, it's depends from the path/filename where the buffer will be stored.

Is there perhaps any way to recognize it's a write confirmation message, catch it, colorize it, and pass it further to the minibuffer?

  • If you are referring to approximately line 5011 of the source-code fileio.c, then see this related thread for a means to rewrite a portion of the saving function -- the idea is that you would be suppressing the built-in message and then use your own message with some color added: emacs.stackexchange.com/questions/14706/…
    – lawlist
    Commented Dec 18, 2015 at 21:49

1 Answer 1


You are referring to messages written to the echo area (not the minibuffer, though the screen space is the same -- the minibuffer is for input; the echo area is for output). And you are referring no doubt to such messages as the output of function message.

message is a built-in function (coded in C), and so in recent Emacs builds you cannot advise it. So you are out of luck wrt capturing its intended output and propertizing it.

But you can at least replace your own calls to message by calls to your own function, rene-message, which first propertizes the formatted string before then passing it to message. Something like this:

(defun rene-message (fmt-strg &rest strgs)
  (message "%s" (propertize (format fmt-strg strgs) 'face 'rene-emphasis))

But if you want to emphasize certain parts of the message then you are better off doing that directly where the message is created. For example:

(message "%s `%s' added to the `%s', file `%s'"
         (propertize entry     'face 'rene-emphasis)
         (propertize set-name  'face 'rene-emphasis)
         (propertize file-name 'face 'rene-emphasis))
  • Thanks for your reply. If I understood it right, you're refering to the message function. I was intending only to give the confirmations of "Wrote [buffer/file name]" a specific color when I'm saving the file. The other messages don't have any change in colors. Your reply is aiming on colorizing the messages in general. Perhaps I'm mistaken and need I to re-read your reply?
    – ReneFroger
    Commented Dec 18, 2015 at 21:12
  • 1
    To change only a specific message you need to find the code that issues it. If that code uses function message to do it then you are out of luck, because we can no longer advise built-in functions (and message is a built-in, not a function defined in Lisp). It is only your own calls to message that you can modify, as I indicated, to pass message a propertized string. That is, in your own code you can get the effect you want, but in existing code that calls message you are pretty much stuck. (You could of course redefine the function in the existing code that calls message.)
    – Drew
    Commented Dec 19, 2015 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.