In the minibuffer I keep seeing:

Wrote /home/user/.emacs.d/recentf

Would it be possible to suppress this message? (Only for file name recentf file)

my minimal.el:

(setq recentf-max-saved-items 50)
(setq recentf-max-menu-items 50)
(setq recentf-exclude '("^/var/folders\\.*"
(run-at-time nil (* 5 60) 'recentf-save-list)
(add-hook 'delete-terminal-functions (lambda (terminal) (recentf-save-list)))
(setq recentf-save-file (recentf-expand-file-name "~/.emacs.d/.recentf"))
(setq recentf-auto-cleanup 10)
(recentf-mode 1)
  • 2
    Maybe advise the recentf function that shows that message, let-binding inhibit-message around the function body?
    – Drew
    Aug 17, 2021 at 14:01
  • @Drew How can I implement your advice?
    – alper
    Aug 28, 2021 at 10:43
  • I wrote you an answer that should do what you want.
    – Drew
    Aug 30, 2021 at 21:53
  • @Drew Thank your sir,
    – alper
    Aug 31, 2021 at 12:26
  • 1
    You're welcome. The code is simple, and it might serve as a more general example, for future reference.
    – Drew
    Aug 31, 2021 at 16:35

1 Answer 1


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))
    (funcall function)))

(advice-add 'recentf-save-list :around 'no-msg)

To see the messages again, use (advice-remove 'recentf-save-list 'no-msg).

  • I am not sure is it related but can similiear approach done for Reverting buffer ‘config.yaml’. for specific file names? If not I can ask new question
    – alper
    Sep 8, 2021 at 9:11

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.