Subject: Re: bug#33400: [PATCH] Let dir locals for more specific modes override those from less

From: Michael Albinus <[email-masked]>
Date: Mon, 29 Apr 2019 14:58:34 +0200

Noam Postavsky <[email-masked]> writes:

>> The list of dir local variables to apply is now sorted by the number
>> of parent modes of the mode used as the key in the association
>> list. That way when the variables are applied in order the variables
>> from more specific modes will override those from less specific modes.
>>
>> If there are directory entries in the list then they are sorted in
>> order of name length. The list of modes for that dir is then
>> recursively sorted with the same mechanism. That way variables tied to
>> a particular subdirectory override those in in a parent directory.
>>
>> Previously the behaviour didn’t seem to be well defined anyway and was
>> dependent on the order they appeared in the file. However this order
>> was changed in version 26.1 and it probably also depended on the
>> number of dir-local files that are merged.
>
> This patch looks basically good to me (some minor formatting: sentences
> should end in double space, and the commit message misses a ChangeLog
> formatted entry), but it exceeds to copyright exemption limit.  Would
> you be willing to sign papers?

I also believe the patch is worth to be applied, to the emacs-26
branch. It fixes a regression introduced with Emacs 26.1.

I'd appreciate if this behavior, priority of .dir-locals entries, is
documented in the Emacs manual. Could this be added to the patch?

Thanks, and best regards, Michael.