2

I am attempting to use Directory-Variables in order to set the flycheck-gcc-language-standard variable. I used: M-x add-dir-local-variable RET c++-mode RET flycheck-gcc-language-standard RET "c++11" to create the .dir-local.el file in the project root directory. Which results in the following code:

((c++-mode  
  (flycheck-gcc-language-standard . "c++11")))

the above creates a warning that this is a "malformed function". I've tried several variations: without quotes, c++0x instead of c++11, among others. Flycheck.el doesn't list what are acceptable variables. I'm stuck.

Any suggestions would be very much appreciated.

If it helps below is the debugger output:

Debugger entered--Lisp error:
(invalid-function (c++-mode (flycheck-gcc-language-standard . c++11)))
((c++-mode (flycheck-gcc-language-standard . c++11)))
eval(((c++-mode (flycheck-gcc-language-standard . c++11))) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)

It seems to me that I'm missing something but I don't know it might be. I new to emacs.

2 Answers 2

0

There is nothing wrong here except that flycheck is giving you a bogus warning because it is seeing c++mode as a function. But a dir-locals.el file just holds a specially-constructed list, which maps major mode names (symbols) to alists.

0
0

In addition to the explanation by Christopher Gray, you can append the following to your .dir-locals.el files to avoid the spurious warnings.

;; Local Variables: 
;; eval: (flycheck-mode -1) 
;; End: 

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.