5

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\\.*"
                        "[/\\]\\.elpa/"
                        "COMMIT_EDITMSG\\'"
                        "\\TODO_archive\\'"
                        ))
(run-at-time nil (* 5 60) 'recentf-save-list)
(add-hook 'delete-terminal-functions (lambda (terminal) (recentf-save-list)))
(recentf-load-list)
(setq recentf-save-file (recentf-expand-file-name "~/.emacs.d/.recentf"))
(setq recentf-auto-cleanup 10)
(recentf-mode 1)
Drew
  • 75,699
  • 9
  • 109
  • 225
alper
  • 1,238
  • 11
  • 30

1 Answers1

5

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).

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 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 08 '21 at 09:11