Skip to content

Instantly share code, notes, and snippets.

@masutaka
Last active April 29, 2021 22:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/1325654 to your computer and use it in GitHub Desktop.
Save masutaka/1325654 to your computer and use it in GitHub Desktop.
a timer setting for recentf-mode without notifications to minibuffer.
(require 'cl)
(defvar my-recentf-list-prev nil)
(defadvice recentf-save-list
(around no-message activate)
"If `recentf-list' and previous recentf-list are equal,
do nothing. And suppress the output from `message' and
`write-file' to minibuffer."
(unless (equal recentf-list my-recentf-list-prev)
(cl-flet ((message (format-string &rest args)
(eval `(format ,format-string ,@args)))
(write-file (file &optional confirm)
(let ((str (buffer-string)))
(with-temp-file file
(insert str)))))
ad-do-it
(setq my-recentf-list-prev recentf-list))))
(defadvice recentf-cleanup
(around no-message activate)
"suppress the output from `message' to minibuffer"
(cl-flet ((message (format-string &rest args)
(eval `(format ,format-string ,@args))))
ad-do-it))
(setq recentf-save-file (expand-file-name ".recentf" user-emacs-directory))
(setq recentf-max-saved-items 2000)
(setq recentf-exclude '(".recentf"))
(setq recentf-auto-cleanup 10)
(run-with-idle-timer 30 t 'recentf-save-list)
(recentf-mode 1)
@masutaka
Copy link
Author

I posted the description to my blog.
http://masutaka.net/chalow/2011-10-30-2.html (Japanese version only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment