Subject: Re: bug#74964: 31.0.50 master; .dir-locals.el vars does not work with changing major mode

From: Robert Pluim <[email-masked]>
Date: Fri, 20 Dec 2024 17:20:10 +0100

>>>>> On Thu, 19 Dec 2024 15:53:58 +0800, Yikai Zhao <[email-masked]> said:

    Yikai> How to reproduce:
    Yikai> With following content in /tmp/test/.dir-locals.el:

    Yikai> ((nil . ((my/test . "test")))
    Yikai>  (c-mode . ((eval . (when (eq major-mode 'c-mode)
    Yikai>                       (c++-mode))))))
    Yikai> ;; I use this code because I want my projects' .h files always opened
    Yikai> in c++ mode

    Yikai> Then open a new file test.c in the folder.

    Yikai> Expected behavior: my/test variable is set.
    Yikai> Actual behavior: my/test variable is not set.

    Yikai> Emacs 29 and 30 does give me the expected result.

Stefan, reverting f713258416f (Bug#74349) fixes this

Robert
--