[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add a separate mode for .dir-locals.el

From: Eli Zaretskii
Subject: Re: Add a separate mode for .dir-locals.el
Date: Sat, 19 Oct 2019 17:14:33 +0300

> From: Clément Pit-Claudel <address@hidden>
> Date: Sat, 19 Oct 2019 08:53:23 -0400
> Cc: address@hidden, address@hidden
> Yes, I can describe in more details. [...]

Thanks, Clément, for your detailed description.  It really makes the
situation with Flymake crystal clear.

> My motivation for proposing a separate mode was that we already have a 
> mechanism (atuo-mode-alist) to attach specific behaviors to specific file 
> names, so it seemed natural to reuse that mechanism to run different code for 
> regular ELisp files and dir-locals files.  IOW, I thought it was an 
> anti-pattern to do file-name checks in a major-mode definition.  

But this part only works for .dir-locals.el files, it will not work
for any file named otherwise.  E.g., my saveplace file is called
_places.sav (for boring historical reasons), and the only way of using
such a new mode for it would be to manually turn it on when that file
is visited.  The same will happen with ~/.emacs.d/bookmarks and for
many other files that just hold Lisp data.

That's not how our major modes work: Emacs almost always turns them on
automatically, by examining the file's name or contents.

> Finally, what motivated me to propose a split was the fact that a fix was 
> needed in two places (Flymake and Flycheck), and likely in others (company 
> and completion-at-point-functions should ideally work differently in 
> .dir-locals.el; imenu doesn't make much sense there, ELisp 
> syntax-highlighting is sub-optimal for these files outside of `eval' forms, 
> etc.).

I suggested to collect the traits common to these files, and then
discuss what would be the appropriate mode for them.  I don't think we
have now a clear picture of what is or might be needed.  In
particular, I don't think we have enough data to decide whether
elisp-mode should support such files as a built-in feature, or there's
enough differences to justify a separate mode.  In the latter case, we
will have to devise some way of turning on that new mode automatically
in most cases.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]