emacs-devel
[Top][All Lists]
Advanced

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

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


From: João Távora
Subject: Re: Add a separate mode for .dir-locals.el
Date: Sat, 19 Oct 2019 12:00:10 +0100

On Sat, Oct 19, 2019 at 10:52 AM Eli Zaretskii <address@hidden> wrote:

> Thanks, but I didn't ask for a summary, I asked for a detailed
> description of the original problem which started this thread.

Really?  Let me quote you:

> > > Where?  Maybe I've missed that, so please summarize it for me.
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Now let me quote an exchange from two days ago:

> > >  EZ: Can we step back a notch and start by describing the problem in
> > >  EZ: more detail?  What diagnostics does Flymake produce in the case
> > >  EZ: of .dir-locals.el, and why does it produce that diagnostics?
> > JT: I haven't checked, but if I had to guess, I would say it tries to invoke
> > JT: the byte-compiler on the file, which doesn't make any sense, as you
> > JT: know. As a result, bogus diagnostics are produced.
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That's it. Try it. It's not complicated at all. Type M-x flymake-mode
RET in a dir-locals buffer, you get bogus diagnostics because the wrong
flymake checker is being applied to the file.  I even attach a
screeshot.

The expected behaviour, in the absence of a proper dir-locals checker,
would be that (1) Flymake didn't turn itself on at all in these files or
(2) It didn't use the wrong backends.

And Clément also mentioned the same problem happens with Flycheck, a
package that is not in Emacs, but is very popular.  And the reason is
exactly the same: Flycheck hooks onto `emacs-lisp-mode-hook' (or uses
some equivalent mechanism) and produces bogus diagnostics for a
dir-locals.el, a file that is not an emacs-lisp-program.

It's really not complicated at all.

> Creating a major mode for this issue is like shooting sparrows with
> cannons.  Why not extend emacs-lisp-mode to DTRT with
> data-that-doesn't-make-sense-as-code instead?

That is _exactly_ what Clément proposed in his original patch.  It's
better than the "just hack Flymake" solution, it isn't ideal because it
relies on us (or the user) remembering to _undo_ whatever he (or we) add
to emacs-lisp-mode (or emacs-lisp-mode-hook) that doesn't work for
"data-that-doesn't-make-sense-as-code".

João

Attachment: Screenshot 2019-10-19 at 11.56.42.png
Description: PNG image


reply via email to

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