1

I use this setup to setup blacklists for ccls in my project:

(
(prog-mode (ccls-initialization-options . (:index (:blacklist [
"^/Users/xxx/proj/dir1/"
"^/Users/xxx/proj/dir2/(dir3|dir4)/"])))
)

How do I make it dependent on (projectile-project-root) instead?

This didn't work:

(
 (nil . ((eval . (progn
                   (require 'projectile)
                   (setq ccls-initialization-options (:index
                                                      (:blacklist
                                                       (vector
    (concat "^" (projectile-project-root) "dir1/")
    (concat "^" (projectile-project-root) "dir2/(dir3|dir4)/"))))))))))
)
  • 1
    "This didn't work" -- You should state how it failed, to help people understand the nature of the problem more easily. – phils Nov 21 '19 at 2:39
  • Thanks phill, will do next time. You answered it correctly for this one. Thanks a lot. – SFbay007 Nov 21 '19 at 3:44
  • 1
    Tangentially, for general usage you should consider whether you need to escape potential regexp-special characters in the value of (projectile-project-root). For elisp regexps you would pass it through regexp-quote, but it's evident that these values are destined for something else, so you might need to do something more custom (or just ignore the issue if you believe you can do so in practice -- there's a reasonable chance that a directory path is going to be safe as-is). – phils Nov 21 '19 at 4:42
1

You were pretty close.

I imagine you want something like this?

((nil . ((eval . (progn
                   (require 'projectile)
                   (setq-local ccls-initialization-options
                               `(:index
                                 (:blacklist
                                  ,(vector
                                    (concat "^" (projectile-project-root)
                                            "dir1/")
                                    (concat "^" (projectile-project-root)
                                            "dir2/(dir3|dir4)/"))))))))))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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