0

I understand from here, that I can use dir-locals.el to customize modes, such as given in the example:

      ;; Warn about spaces used for indentation:
      (haskell-mode . ((eval . (highlight-regexp "^ *"))))
      (c-mode . ((c-file-style . "BSD")))
      (java-mode . ((c-file-style . "BSD")))
      ("src/imported"
       . ((nil . ((change-log-default-name . "ChangeLog.local"))))))

However, all of these make 1 change per language-mode. I would like to make multiple changes to the same mode, python-mode, and I think my syntax is only keeping the first one.

What's the right syntax to combine these two variables settings in dir-locals.el?

I have:

;; misc
((python-mode
  (python-shell-buffer-name . "Python[This Project]")))

;; set the local pyvenv
((python-mode . ((pyvenv-activate . "./envs/default")
                 )))

;; find local pylintrc vs global
((python-mode . ((eval . (lambda ()  (setq flycheck-pylintrc ".pylintrc"))))))

Other refs consulted:

2
  • 2
    For each mode you can have an alist. The alist can specify any number of settings. See the example with nil (which stands for any mode) in the Emacs Wiki page you cite. Change nil to python-mode and you have an example of setting multiple things for Python mode. – Drew Nov 10 '20 at 18:46
  • Could you point me to an example? – Mittenchops Dec 23 '20 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.