I'm trying to ignore some file patterns while performing helm-projectile-grep
and some with helm-projectile-find-file
. I've found that it could be achieved using .dir-locals.el
here.
Following this chunk of documentation I've made my .dir-locals.el
looks like:
((nil
(grep-find-ignored-files . '("*.log"))
(projectile-globally-ignored-files . '("*.log"))))
When helm-projectile-grep
is called it yields an error in helm-projectile
:
Error running timer `helm-projectile-grep-or-ack': (wrong-type-argument stringp quote)
Since both emacs manual and projectile docs are sketchy about .dir-locals.el
and it's usage I have few questions?
- How
.dir-locals.el
works? Does it merge global and dir-local value of an variable? If I have a variablea
which is'("a" "b")
and set it in dir-local to'("c")
, what is its value that Emacs use when I perform an operation in certain scope of.dir-locals.el
? - What kind of structure is expected in
.dir-locals.el
forgrep-find-ignored-files
andprojectile-globally-ignored-files
?
On Projectile itself:
- Why Projectile
helm-projectile-grep
andhelm-projectile-find-file
don't ignore file patterns which are already ignored in.gitignore
? Is it turned off somewhere in my config?
Solution
According to accepted answer, if you want to ignore e.g all the .md
files from Projectile operations in your project using .dir-locals.el
you should do something like this:
((nil
(eval . (set (make-local-variable 'projectile-globally-ignored-files)
(append projectile-globally-ignored-files
(f-entries (projectile-project-root)
(lambda (f) (string-match "\\.md$" f)) t))))))
toggle-debug-on-error
to see where it's coming from. 2.projectile
does ignore files in.gitignore
, at least I am certain abouthelm-projectile-find-files
. It's impossible to say why you see a different behavior without dissecting yourinit.el
.helm-projectile-grep
after visiting some file in project to see exactly the same error as I've seen. Question is updated now.wrong-type-argument stringp quote
on visiting file when you use.dir-locals.el
from above? Debugger says that projectile try toexpand-file-name(quote "/my/project/root/")
. It would be very strange to me if your Projectile doesn't try to do the same.quote
symbol as the first element. Which is not a string, and that's the error. Looks weird and doesn't match eitherProjectile
docs or my understanding. I have deleted my partial answer while I am trying to understand the reason (and maybe correct myself if I was wrong somewhere.)