3

So, I know that I can assign a variable via .dir-locals.el...

("thingy" (1 2 3 4))

but is there any way that I can append to an array, if at all?

("that" . "is correct")
(add-to-list 'thingy 5)
1
  • 2
    You can use eval.
    – NickD
    May 18, 2022 at 13:53

1 Answer 1

1

From the GNU Emacs Manual:

You can specify the variables mode, eval, and unibyte in your .dir-locals.el, and they have the same meanings as they would have in file local variables. coding cannot be specified as a directory local variable. See Local Variables in Files.

Variables in .dir-locals.el are mode specific. You have to explicitly specify the mode that you are using, it is not a simple key/value store.

The eval keyword means you can execute Lisp code, this means you may call add-to-list and modify variables as needed.

((org-mode . ((eval . (add-to-list 'org-publish-project-alist
 ("org-project" (:output-dir "~/org-out")))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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