I have a project with a .dir-locals.el
file. This file contains some customizations for various project local variables, e.g. include directories for semantic
and arguments for clang
.
First time opening the project, Emacs asks if I want to consider these variables safe. Obviously I press !
, because I don't want to do this every time I open up Emacs.
The problem is that my init.el
is part of a git repository, and these local customizations are saved inside the init file as such:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
[...]
'(safe-local-variable-values
'((eval semantic-add-system-include "custom/include/path")
[...]
))
But, IMO., these customizations are meant to be local, ie. not included in the git worktree. And I would really like to not having to include them in the init file.
Could I perhaps point to these safe-local-variable-values
by storing them inside another elisp file, and then .gitignore
that file instead? And how could I achieve this? Or is there a better way?
Edit:
There's a related answer here, but that moves ALL customizations inside another file, whereas I would like to filter ONLY on the safe-local-variable-values
(hoping that it's actually possible).
flycheck-clang-include-path
andflycheck-clang-args
, avoiding .dir-locals.el. Some other(s) may be set withlsp-mode
.