2

I use company-statistics to sort completion candidates by previous completion choices. It works perfectly, except there is only tiny problem. The file ~/.emacs.d/company-statistics-cache.el pops up in recentf-mode and I'd like recentf-mode to not display this file. How can I achieve this ?

I added the path of the file to the symbol recentf-exclude but that did not help. I also tried adding the path of the directory itself and that didn't help either.

4
(add-to-list 'recentf-exclude "company-statistics-cache.el")

or more accurately

(add-to-list 'recentf-exclude
             (expand-file-name "~/.emacs.d/company-statistics-cache.el"))

then run M-x recentf-cleanup to make it work.

Anyway, the regexp you set in recentf-exclude must match the $HOME/.emacs.d/company-statistics-cache.el (~ is expanded into $HOME), so regexp like ~/.emacs.d/company-statistics-cache.el does not work.

| improve this answer | |
  • Is there any way to ignore empty files as well like __init__? – alper Jun 5 at 23:42
  • @alper I think yes since recentf-exclude supports both regexp and function. – xuchunyang Jun 6 at 0:10
  • I have added (add-to-list 'recentf-exclude "\\__init__.\\'") but seems like it still shows up :( – alper Jun 6 at 0:23
  • @alper your regexp is invalid. – xuchunyang Jun 6 at 3:49
  • Shouldn't I write the filename in between `\` ? @xuchunyang – alper Jun 6 at 13:53

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