Subject: Re: Can tramp load .dir-locals.el in a project?

From: Michael Albinus <[email-masked]>
Date: Mon, 02 Aug 2010 16:36:27 +0200

Leo <[email-masked]> writes:

> On 2010-05-20 17:04 +0100, Michael Albinus wrote:
>> | If you put a file with a special name `.dir-locals.el'(1) in a
>> | directory, Emacs will read it when it visits any file in that directory
>> | or any of its subdirectories, and apply the settings it specifies to
>> | the file's buffer.  Emacs searches for `.dir-locals.el' starting in the
>> | directory of the visited file, and moving up the directory tree.  (To
>> | avoid slowdown, this search is skipped for remote files.)
>>
>> I wouldn't like to overrule this on my own. If you believe it is
>> important, you might ask on the emacs-devel mailing list for this. Maybe
>> one could enable this by a custom variable.
>
> I have reported this as a bug.¹ I think it is important enough for the
> .dir-locals.el to be loaded, otherwise, users end up editing files in a
> way non-conforming to the requirement of a project and editing is the
> most important reason to use tramp for the comfort of Emacs.
>
> Would be interesting to hear your thought and input. Thanks.

Loading .dir-locals.el is a non-trivial operation, because several
directories must be traversed for existence check of such a file,
starting at the current directory, and navigating up to "/". This might
be time-consuming.

I suspect, this is the reason it has been disabled for remote
directories.

One could improve the checks by adding a new file name handler for
searching and loading of .dir-locals.el. This would allow to apply all
checks at once on the remote side, with a better performance.

A similar file name handler was introduced for `vc-registered', which
was improved by a special implementation for remote files.

> Kind regards,
> Leo

Best regards, Michael.