Problem with emacs local variables

I am using the latest version of NTEmacs. I wrote a file called ".dir-locals.el" as shown below.

((nil . ((tab-width . 8) (fill-column . 70))) (c-mode . ((c-file-style . "GNU")))) 

and I opened the c file in a subdirectory, I got an error message:

Directory local variable error: (invalid listp argument name)

I canโ€™t understand what is wrong with this code.

+4
source share
2 answers

The second part of the expression is a list of variables, so you need more brackets

 ((nil . ((tag-width . 8) (fill-column . 70))) (c-mode . ((c-file-style . "GNU")))) 

It worked for me. To get his work, I added a quote at the beginning and evaluated the expression, and then tracked it from there.

Then deleted the quote when it worked.

+5
source

I had a very similar problem: emacs complains about the same error in the .dir-locals.el file with similar content. In my case, I found that the problem was in the invisible space characters that were present in the file. (I noticed that Skype chat sometimes introduces strange white space characters into text.) As soon as I removed all the extra spaces, it worked.

+1
source

Source: https://habr.com/ru/post/1299086/


All Articles