How to ignore emacs backup (*~) files in projectile? My code does not work.

(use-package projectile
    (setq projectile-globally-ignored-files
          (append '(
    (setq projectile-completion-system 'helm)
    (setq projectile-enable-caching t)
    (defconst projectile-mode-line-lighter " P")

When I call helm-projectile-find-other-file I always see backup files which is quite annoying.

2 Answers 2


The variable projectile-globally-ignored-files should be populated with literal filename suffixes, not glob patterns. Admittedly the variable's documentation does not make this obvious.

So your code could be rewritten as

(use-package projectile
  (setq projectile-completion-system 'helm
        projectile-enable-caching    t
        (append '(".pyc"
  (defconst projectile-mode-line-lighter " P"))

My other suggested changes to your code, as seen in my example, are the following:

  • Use projectile-mode instead of obsolete projectile-global-mode.
  • Call setq once.
  • Do not put closing parentheses on lines by themselves, as per the Emacs Coding Conventions.
  • Remove redundant progn from use-package :config clause.

By the way, is the projectile-mode-line-lighter necessary? I don't see projectile making use of it.


I had the same experience, finding this very confusing. Eventually, I figure out that I had to run M-x projectile-invalidate-cache for the changes to projectile-globally-ignored-* to be heeded.

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.