unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Max Brieiev <max.brieiev@gmail.com>, 48452@debbugs.gnu.org
Subject: bug#48452: 28.0.50; flymake for elisp does not respect `load-path`
Date: Fri, 15 Jul 2022 11:03:35 +0100	[thread overview]
Message-ID: <CALDnm50u_1Of2Ot7pACJDXUxcW79sj9u+MdwCMQXW2R_S19pVQ@mail.gmail.com> (raw)
In-Reply-To: <87r12mogh9.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]

On Fri, Jul 15, 2022 at 10:47 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> João Távora <joaotavora@gmail.com> writes:
>
> > I think elisp-flymake-byte-compile-load-path is relevant here.
>
> I think the question here was -- why doesn't that just default to
> `load-path'?  I'd expect the flymake environment to be similar to the
> environment in my running Emacs.
>

When I was first coding this backend, I had that expectation too.
But it's not very useful, as you normally, when developing an elisp
file in a package, you want to be made aware of the potential compilation
problems arising when compiling that file in a much simpler environment,
very often the Emacs -Q environment where Makefiles usually byte-compile
files.

It's really not very useful, in my opinion and experience, if the same
elisp file
in the same project visited from two different Emacs sessions shows
different
sets of errors.

And there's also the question of security.  Flymake runs compile-time
code every time by simply modifying the buffer.  So being conservative
here is also a good idea because of that.

Once I was working on a macro and I temporarily put a `delete-file` in
there,
which I later deleted because I had given it the wrong argument.
The macro was being expanded at top level. The file was gone.

Anyway, because the directories under ~/.emacs.d/elpa are somewhat special
and/or security-vetted it _could_ make sense to add them to the default
value of the variable. This would amount to more or less the same as
calling the underlying process with `-f package-initialize` I think.

But I'm still not sure this should be the default, or merely an option to
the flymake-elisp-byte-compile backend.  I think the second is safer.

BTW, this is very similar to other "on-the-fly" backends like C/C++
checkers
which add some "system" things to the include path considered when checking,
but still need to know about the user's include paths.  Google
compilation_commands.json or "compilation database".  These are normally
files checked into the repository, or very easy to generate. Of course in
Elisp,
we probably don't need such complexity: merely adjusting the variable I gave
and/or putting that in the repo's dir-locals.el suffices.


João

[-- Attachment #2: Type: text/html, Size: 3186 bytes --]

  reply	other threads:[~2022-07-15 10:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 20:46 bug#48452: 28.0.50; flymake for elisp does not respect `load-path` Max Brieiev
2022-07-13 11:47 ` Lars Ingebrigtsen
2022-07-13 13:47   ` Max Brieiev
2022-07-13 13:57     ` Lars Ingebrigtsen
2022-07-13 16:24       ` Max Brieiev
2022-07-14 17:15         ` Lars Ingebrigtsen
2022-07-14 20:29           ` João Távora
2022-07-15  9:46             ` Lars Ingebrigtsen
2022-07-15 10:03               ` João Távora [this message]
2022-07-16 10:12                 ` Lars Ingebrigtsen
2022-07-18 19:17                   ` João Távora
2022-07-22 19:52                     ` Lars Ingebrigtsen
2022-07-22 21:09                       ` João Távora
2022-07-22 21:12                         ` Lars Ingebrigtsen
2022-07-22 21:46                           ` João Távora
2022-07-23  5:50                             ` Lars Ingebrigtsen
2022-07-23  9:24                               ` João Távora
2022-07-23 14:26                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-23 17:45                                   ` João Távora
2022-07-23 17:55                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-24  9:18                                     ` Lars Ingebrigtsen
2022-07-24  9:57                                       ` João Távora
2022-07-23 15:05                                 ` Max Brieiev
2022-07-23 17:16                                   ` João Távora
2022-07-15 11:53             ` Max Brieiev
2022-07-14  9:22       ` Max Brieiev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm50u_1Of2Ot7pACJDXUxcW79sj9u+MdwCMQXW2R_S19pVQ@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=48452@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=max.brieiev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).