2

I have this code in my .dir-locals.el file:

  (eval . (let ((root (projectile-project-root)))
            (setq-local company-clang-arguments
                        (list (concat "-I" root "headers")
                              (concat "-I" root "source/mon")
                  ))
            (setq-local flycheck-clang-include-path
                        (list (concat root "headers")
                              (concat root "source/mon")
                  ))))
  ))

But everytime I start emacs it asks to apply the code and if it is safe (multiple times) and even when choosing the ! option to save my selection it continues to ask these questions on each emacs startup.

How to trust everything in this file and not prompt for this safety warning?

  • duplicate – sds Jun 5 '17 at 1:25
  • Please do not cross-post the same question at the same time on this site and Stack Overflow. Please pick one or the other. – Dan Jun 5 '17 at 2:48
1

Your example code isn't a valid .dir-locals.el on its own, but I tested the following .dir-locals.el, with the projectile package installed from MELPA, and (require 'projectile) in my init.el (because the projectile-project-root function isn't autoloaded), and an empty TAGS file in the directory I was testing with, to act as a projectile root, and I did not experience any issues using ! to update the safe-local-variable-values in the custom-set-variables section of my init file.

((nil . ((eval . (let ((root (projectile-project-root)))
                   (setq-local company-clang-arguments
                               (list (concat "-I" root "headers")
                                     (concat "-I" root "source/mon")))
                   (setq-local flycheck-clang-include-path
                               (list (concat root "headers")
                                     (concat root "source/mon"))))))))

Assuming there aren't any errors being generated (in which case you should have included them in the question), you should check that you can successfully customize and save other values to your init file (or custom-file), to ensure it's not just a generic issue with file permissions or something?

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.