GNU bug report logs - #65035
29.1; Port flycheck-emacs-lisp-initialize-packages to flymake

Previous Next

Package: emacs;

Reported by: Antonio Romano <n58r <at> pm.me>

Date: Thu, 3 Aug 2023 10:05:01 UTC

Severity: normal

Found in version 29.1

To reply to this bug, email your comments to 65035 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Thu, 03 Aug 2023 10:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Antonio Romano <n58r <at> pm.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Aug 2023 10:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Antonio Romano <n58r <at> pm.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Thu, 03 Aug 2023 10:04:24 +0000

Flycheck includes the "flycheck-emacs-lisp-initialize-packages"
customizable variable, which allows packages to be initialized in the
Emacs subprocess used to lint the elisp file. With this variable, it is
possible for the linter to be aware of autoloads from installed
packages.

I think that having such option on the built-in alternative "flymake"
would be a good quality-of-life addition, as this would make it more
suitable for linting personal configuration and only one M-x away from
any user who would want to try it.

Thanks in advance








Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Wed, 23 Oct 2024 09:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Pengji Zhang <me <at> pengjiz.com>
To: 65035 <at> debbugs.gnu.org
Subject: Re: 29.1; Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Wed, 23 Oct 2024 17:01:23 +0800
Hi!

I am switching to Flymake and I missed this feature as well. I think
this bug report is related:

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452

In that thread João gave a patch that implements this feature (sort of):

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452#43

Although it was not installed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Wed, 23 Oct 2024 10:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pengji Zhang <me <at> pengjiz.com>, sbaugh <at> janestreet.com
Cc: João Távora <joaotavora <at> gmail.com>,
 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Wed, 23 Oct 2024 13:32:13 +0300
> From: Pengji Zhang <me <at> pengjiz.com>
> Date: Wed, 23 Oct 2024 17:01:23 +0800
> 
> I am switching to Flymake and I missed this feature as well. I think
> this bug report is related:
> 
>     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452
> 
> In that thread João gave a patch that implements this feature (sort of):
> 
>     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452#43
> 
> Although it was not installed.

Adding Spencer, who nowadays maintains Flymake, and João.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Wed, 23 Oct 2024 11:18:01 GMT) Full text and rfc822 format available.

Message #14 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: sbaugh <at> janestreet.com, 65035 <at> debbugs.gnu.org, Pengji Zhang <me <at> pengjiz.com>
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Wed, 23 Oct 2024 12:15:22 +0100
On Wed, Oct 23, 2024 at 11:33 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Pengji Zhang <me <at> pengjiz.com>
> > Date: Wed, 23 Oct 2024 17:01:23 +0800
> >
> > I am switching to Flymake and I missed this feature as well. I think
> > this bug report is related:
> >
> >     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452
> >
> > In that thread João gave a patch that implements this feature (sort of):
> >
> >     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48452#43
> >
> > Although it was not installed.
>
> Adding Spencer, who nowadays maintains Flymake, and João.

Feel free to use my patch of course.  Stefan noted some time ago
that -f package-initialize is the wrong flag to ask Emacs -Q to use
elpa though, so there's something better.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Fri, 25 Oct 2024 11:52:02 GMT) Full text and rfc822 format available.

Message #17 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Pengji Zhang <me <at> pengjiz.com>
To: 65035 <at> debbugs.gnu.org
Cc: sbaugh <at> janestreet.com, Eli Zaretskii <eliz <at> gnu.org>,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#65035: 29.1; Port flycheck-emacs-lisp-initialize-packages
 to flymake
Date: Fri, 25 Oct 2024 19:50:48 +0800
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> gmail.com> writes:

> Feel free to use my patch of course.  Stefan noted some time ago
> that -f package-initialize is the wrong flag to ask Emacs -Q to use
> elpa though, so there's something better.

Thanks! I prepared a new patch based on yours.

Regards,
Pengji

[0001-Add-option-elisp-flymake-byte-compile-activate-packa.patch (text/x-patch, inline)]
From be772ff2f3bae82977d6c54fa84960f721ba088e Mon Sep 17 00:00:00 2001
From: Pengji Zhang <me <at> pengjiz.com>
Date: Fri, 25 Oct 2024 19:44:44 +0800
Subject: [PATCH] Add option 'elisp-flymake-byte-compile-activate-packages'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This option controls whether the Flymake Emacs Lisp
byte-compiler should activate user installed packages before
checking the source buffer.  (Bug#65035)

* lisp/progmodes/elisp-mode.el
(elisp-flymake-byte-compile-user-file-p): New predicate function
to check if a buffer is visiting a user file.
(elisp-flymake-byte-compile-activate-packages): New option.
(elisp-flymake--byte-compile-activate-packages): New variable
for caching.
(elisp-flymake-byte-compile): Use the new option.

* etc/NEWS: Announce the new option.

Co-authored-by: João Távora <joaotavora <at> gmail.com>
---
 etc/NEWS                     |  7 ++++++
 lisp/progmodes/elisp-mode.el | 41 ++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index a6c2c895985..090f4293c8e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -413,6 +413,13 @@ This affects calls to 'warn', 'lwarn', 'display-warning', and
 In most cases, having it enabled leads to a large amount of false
 positives.
 
+---
+*** New user option 'elisp-flymake-byte-compile-activate-packages'.
+This option controls whether or not the Flymake byte-compiler backend
+should activate user installed packages before compiling the source
+buffer.  By default, it is set to activate packages when checking user
+configuration files.  Set it to nil to restore the previous behavior.
+
 ** DocView
 
 ---
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 2f931daedc7..8a9dce5d3f6 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2190,6 +2190,39 @@ elisp-flymake-byte-compile-load-path
 
 (defvar bytecomp--inhibit-lexical-cookie-warning)
 
+(defun elisp-flymake-byte-compile-user-file-p (buffer)
+  "Return non-nil if BUFFER is visiting a user file.
+That means either the file is `user-init-file' or it is in
+`user-emacs-directory'."
+  (when-let* ((file (buffer-local-value 'buffer-file-truename buffer)))
+    (or (and user-emacs-directory
+             (file-in-directory-p file user-emacs-directory))
+        (and user-init-file
+             (string= file (abbreviate-file-name
+                            (file-truename user-init-file)))))))
+
+(defcustom elisp-flymake-byte-compile-activate-packages
+  #'elisp-flymake-byte-compile-user-file-p
+  "Whether to activate packages for Flymake elisp byte-compilation.
+If the value is nil, do not activate installed packages.  If the value
+is a function, it is called with one argument, the source buffer to be
+checked, and installed packages are activated if the function returns
+non-nil.  Otherwise, packages are always activated.
+
+Note that for efficiency the return value of the predicate function is
+cached the first time it is called.  Type \\[revert-buffer-quick] to
+invalidate the cached value."
+  :type '(choice
+          (const :tag "Don't activate" nil)
+          (const :tag "Always activate" t)
+          (const :tag "Activate for user files"
+                 elisp-flymake-byte-compile-user-file-p)
+          (function :tag "Predicate function"))
+  :group 'lisp)
+
+(defvar-local elisp-flymake--byte-compile-activate-packages :unset
+  "Cached value for `elisp-flymake-byte-compile-activate-packages'.")
+
 ;;;###autoload
 (defun elisp-flymake-byte-compile (report-fn &rest _args)
   "A Flymake backend for elisp byte compilation.
@@ -2205,6 +2238,12 @@ elisp-flymake-byte-compile
     (save-restriction
       (widen)
       (write-region (point-min) (point-max) temp-file nil 'nomessage))
+    (when (eq elisp-flymake--byte-compile-activate-packages :unset)
+      (setq elisp-flymake--byte-compile-activate-packages
+            (if (functionp elisp-flymake-byte-compile-activate-packages)
+                (funcall elisp-flymake-byte-compile-activate-packages
+                         source-buffer)
+              elisp-flymake-byte-compile-activate-packages)))
     (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*"))
            ;; Hack: suppress warning about missing lexical cookie in
            ;; *scratch* buffers.
@@ -2223,6 +2262,8 @@ elisp-flymake-byte-compile
                    ;; "--eval" "(setq load-prefer-newer t)" ; for testing
                    ,@(mapcan (lambda (path) (list "-L" path))
                              elisp-flymake-byte-compile-load-path)
+                   ,@(when elisp-flymake--byte-compile-activate-packages
+                       '("-f" "package-activate-all"))
                    ,@warning-suppression-opt
                    "-f" "elisp-flymake--batch-compile-for-flymake"
                    ,temp-file)
-- 
2.47.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Sat, 09 Nov 2024 09:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pengji Zhang <me <at> pengjiz.com>, sbaugh <at> janestreet.com
Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1; Port flycheck-emacs-lisp-initialize-packages
 to flymake
Date: Sat, 09 Nov 2024 11:19:15 +0200
> From: Pengji Zhang <me <at> pengjiz.com>
> Cc: sbaugh <at> janestreet.com, João Távora
>  <joaotavora <at> gmail.com>, Eli Zaretskii
>  <eliz <at> gnu.org>
> Date: Fri, 25 Oct 2024 19:50:48 +0800
> 
> João Távora <joaotavora <at> gmail.com> writes:
> 
> > Feel free to use my patch of course.  Stefan noted some time ago
> > that -f package-initialize is the wrong flag to ask Emacs -Q to use
> > elpa though, so there's something better.
> 
> Thanks! I prepared a new patch based on yours.

Thanks.  Spencer, any comments?

> +(defcustom elisp-flymake-byte-compile-activate-packages
> +  #'elisp-flymake-byte-compile-user-file-p
> +  "Whether to activate packages for Flymake elisp byte-compilation.
> +If the value is nil, do not activate installed packages.  If the value
> +is a function, it is called with one argument, the source buffer to be
> +checked, and installed packages are activated if the function returns
> +non-nil.  Otherwise, packages are always activated.
> +
> +Note that for efficiency the return value of the predicate function is
> +cached the first time it is called.  Type \\[revert-buffer-quick] to
> +invalidate the cached value."

I think the doc string should explicitly mention
elisp-flymake-byte-compile-user-file-p, since it is used as the
default value of the option.

> +  :type '(choice
> +          (const :tag "Don't activate" nil)
> +          (const :tag "Always activate" t)
> +          (const :tag "Activate for user files"
> +                 elisp-flymake-byte-compile-user-file-p)
> +          (function :tag "Predicate function"))
> +  :group 'lisp)

Please add a :version tag here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Sun, 10 Nov 2024 01:34:02 GMT) Full text and rfc822 format available.

Message #23 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Pengji Zhang <me <at> pengjiz.com>
To: Eli Zaretskii <eliz <at> gnu.org>, sbaugh <at> janestreet.com
Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1; Port flycheck-emacs-lisp-initialize-packages
 to flymake
Date: Sun, 10 Nov 2024 09:33:30 +0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> I think the doc string should explicitly mention
> elisp-flymake-byte-compile-user-file-p, since it is used as the
> default value of the option.
>
> [...]
>
> Please add a :version tag here.

Thanks for the review! Fixed in the attached updated patch.

Pengji

[0001-Add-option-elisp-flymake-byte-compile-activate-packa.patch (text/x-patch, inline)]
From 6d34dcc9de1f99c795d0a6bcaa416e29c8500eed Mon Sep 17 00:00:00 2001
From: Pengji Zhang <me <at> pengjiz.com>
Date: Sun, 10 Nov 2024 09:30:01 +0800
Subject: [PATCH] Add option 'elisp-flymake-byte-compile-activate-packages'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This option controls whether the Flymake Emacs Lisp
byte-compiler should activate user installed packages before
checking the source buffer.  (Bug#65035)

* lisp/progmodes/elisp-mode.el
(elisp-flymake-byte-compile-user-file-p): New predicate function
to check if a buffer is visiting a user file.
(elisp-flymake-byte-compile-activate-packages): New option.
(elisp-flymake--byte-compile-activate-packages): New variable
for caching.
(elisp-flymake-byte-compile): Use the new option.

* etc/NEWS: Announce the new option.

Co-authored-by: João Távora <joaotavora <at> gmail.com>
---
 etc/NEWS                     |  7 ++++++
 lisp/progmodes/elisp-mode.el | 46 ++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index a6c2c895985..090f4293c8e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -413,6 +413,13 @@ This affects calls to 'warn', 'lwarn', 'display-warning', and
 In most cases, having it enabled leads to a large amount of false
 positives.
 
+---
+*** New user option 'elisp-flymake-byte-compile-activate-packages'.
+This option controls whether or not the Flymake byte-compiler backend
+should activate user installed packages before compiling the source
+buffer.  By default, it is set to activate packages when checking user
+configuration files.  Set it to nil to restore the previous behavior.
+
 ** DocView
 
 ---
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 2f931daedc7..3905300c9a8 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2190,6 +2190,44 @@ elisp-flymake-byte-compile-load-path
 
 (defvar bytecomp--inhibit-lexical-cookie-warning)
 
+(defun elisp-flymake-byte-compile-user-file-p (buffer)
+  "Return non-nil if BUFFER is visiting a user file.
+That means either the file is `user-init-file' or it is in
+`user-emacs-directory'."
+  (when-let* ((file (buffer-local-value 'buffer-file-truename buffer)))
+    (or (and user-emacs-directory
+             (file-in-directory-p file user-emacs-directory))
+        (and user-init-file
+             (string= file (abbreviate-file-name
+                            (file-truename user-init-file)))))))
+
+(defcustom elisp-flymake-byte-compile-activate-packages
+  #'elisp-flymake-byte-compile-user-file-p
+  "Whether to activate packages for Flymake elisp byte-compilation.
+If the value is nil, do not activate installed packages.  If the value
+is a function, it is called with one argument, the source buffer to be
+checked, and installed packages are activated if the function returns
+non-nil.  Otherwise, packages are always activated.
+
+The default value is a predicate function
+`elisp-flymake-byte-compile-user-file-p' (which see), and that means
+packages are activated only for user configuration files.
+
+Note that for efficiency the return value of the predicate function is
+cached the first time it is called.  Type \\[revert-buffer-quick] to
+invalidate the cached value."
+  :type '(choice
+          (const :tag "Don't activate" nil)
+          (const :tag "Always activate" t)
+          (const :tag "Activate for user files"
+                 elisp-flymake-byte-compile-user-file-p)
+          (function :tag "Predicate function"))
+  :group 'lisp
+  :version "31.1")
+
+(defvar-local elisp-flymake--byte-compile-activate-packages :unset
+  "Cached value for `elisp-flymake-byte-compile-activate-packages'.")
+
 ;;;###autoload
 (defun elisp-flymake-byte-compile (report-fn &rest _args)
   "A Flymake backend for elisp byte compilation.
@@ -2205,6 +2243,12 @@ elisp-flymake-byte-compile
     (save-restriction
       (widen)
       (write-region (point-min) (point-max) temp-file nil 'nomessage))
+    (when (eq elisp-flymake--byte-compile-activate-packages :unset)
+      (setq elisp-flymake--byte-compile-activate-packages
+            (if (functionp elisp-flymake-byte-compile-activate-packages)
+                (funcall elisp-flymake-byte-compile-activate-packages
+                         source-buffer)
+              elisp-flymake-byte-compile-activate-packages)))
     (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*"))
            ;; Hack: suppress warning about missing lexical cookie in
            ;; *scratch* buffers.
@@ -2223,6 +2267,8 @@ elisp-flymake-byte-compile
                    ;; "--eval" "(setq load-prefer-newer t)" ; for testing
                    ,@(mapcan (lambda (path) (list "-L" path))
                              elisp-flymake-byte-compile-load-path)
+                   ,@(when elisp-flymake--byte-compile-activate-packages
+                       '("-f" "package-activate-all"))
                    ,@warning-suppression-opt
                    "-f" "elisp-flymake--batch-compile-for-flymake"
                    ,temp-file)
-- 
2.47.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Tue, 12 Nov 2024 21:57:01 GMT) Full text and rfc822 format available.

Message #26 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65035 <at> debbugs.gnu.org, joaotavora <at> gmail.com, Pengji Zhang <me <at> pengjiz.com>
Subject: Re: bug#65035: 29.1; Port flycheck-emacs-lisp-initialize-packages
 to flymake
Date: Tue, 12 Nov 2024 16:56:11 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Pengji Zhang <me <at> pengjiz.com>
>> Cc: sbaugh <at> janestreet.com, João Távora
>>  <joaotavora <at> gmail.com>, Eli Zaretskii
>>  <eliz <at> gnu.org>
>> Date: Fri, 25 Oct 2024 19:50:48 +0800
>> 
>> João Távora <joaotavora <at> gmail.com> writes:
>> 
>> > Feel free to use my patch of course.  Stefan noted some time ago
>> > that -f package-initialize is the wrong flag to ask Emacs -Q to use
>> > elpa though, so there's something better.
>> 
>> Thanks! I prepared a new patch based on yours.
>
> Thanks.  Spencer, any comments?

I think this should also switch from passing "-Q" to passing just "-q".
If we're include ~/.emacs.d/elpa on load-path, we should include the
site-lisp directories too, which -Q suppresses.

Probably we should specifically pass "--batch --no-site-file" instead of
"-Q --batch", since --batch also implies -q.

(This is particularly relevant for my site, where most packages are
distributed via site-lisp/elpa rather than installed into
package-user-dir)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Thu, 14 Nov 2024 11:19:01 GMT) Full text and rfc822 format available.

Message #29 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Pengji Zhang <me <at> pengjiz.com>
To: Spencer Baugh <sbaugh <at> janestreet.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1; Port flycheck-emacs-lisp-initialize-packages
 to flymake
Date: Thu, 14 Nov 2024 19:18:20 +0800
Spencer Baugh <sbaugh <at> janestreet.com> writes:

> I think this should also switch from passing "-Q" to passing just
> "-q". If we're include ~/.emacs.d/elpa on load-path, we should include
> the site-lisp directories too, which -Q suppresses.

I agree. How about the following change?

--8<---------------cut here---------------start------------->8---
         :name "elisp-flymake-byte-compile"
         :buffer output-buffer
         :command `(,(expand-file-name invocation-name invocation-directory)
-                   "-Q"
+                   ,@(if elisp-flymake--byte-compile-activate-packages
+                         ;; Add site-lisp directories to `load-path' so
+                         ;; that system-wide packages (installed into
+                         ;; site-lisp/elpa) are activated.
+                         '("-q" "--no-site-file")
+                       '("-Q"))
                    "--batch"
                    ;; "--eval" "(setq load-prefer-newer t)" ; for testing
                    ,@(mapcan (lambda (path) (list "-L" path))
--8<---------------cut here---------------end--------------->8---

> Probably we should specifically pass "--batch --no-site-file" instead
> of "-Q --batch", since --batch also implies -q.

I am not sure if it is a good idea to always include the site-lisp
directories. I myself want this only when checking my init.el. When
developing packages, I prefer a pristine environment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Thu, 14 Nov 2024 13:27:02 GMT) Full text and rfc822 format available.

Message #32 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Pengji Zhang <me <at> pengjiz.com>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, Eli Zaretskii <eliz <at> gnu.org>,
 joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Thu, 14 Nov 2024 08:25:24 -0500
[Message part 1 (text/plain, inline)]
Not sure this is 100% relevant to the discussion, but -Q also implies
--no-site-file which inhibits site-start.el. This will interfere with Emacs
builds such as https://github.com/jimeh/emacs-builds for macOS. They
rely on site-start to establish bundled native compiler runtime
dependencies. Running a flymake batch without those dependencies may have
unintended flymake performance implications.

On Thu, Nov 14, 2024 at 6:19 AM Pengji Zhang <me <at> pengjiz.com> wrote:

> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>
> > I think this should also switch from passing "-Q" to passing just
> > "-q". If we're include ~/.emacs.d/elpa on load-path, we should include
> > the site-lisp directories too, which -Q suppresses.
>
> I agree. How about the following change?
>
> --8<---------------cut here---------------start------------->8---
>          :name "elisp-flymake-byte-compile"
>          :buffer output-buffer
>          :command `(,(expand-file-name invocation-name
> invocation-directory)
> -                   "-Q"
> +                   ,@(if elisp-flymake--byte-compile-activate-packages
> +                         ;; Add site-lisp directories to `load-path' so
> +                         ;; that system-wide packages (installed into
> +                         ;; site-lisp/elpa) are activated.
> +                         '("-q" "--no-site-file")
> +                       '("-Q"))
>                     "--batch"
>                     ;; "--eval" "(setq load-prefer-newer t)" ; for testing
>                     ,@(mapcan (lambda (path) (list "-L" path))
> --8<---------------cut here---------------end--------------->8---
>
> > Probably we should specifically pass "--batch --no-site-file" instead
> > of "-Q --batch", since --batch also implies -q.
>
> I am not sure if it is a good idea to always include the site-lisp
> directories. I myself want this only when checking my init.el. When
> developing packages, I prefer a pristine environment.
>
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Sat, 30 Nov 2024 09:49:02 GMT) Full text and rfc822 format available.

Message #35 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: sbaugh <at> janestreet.com, Pengji Zhang <me <at> pengjiz.com>
Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Sat, 30 Nov 2024 11:48:11 +0200
Ping!  Can we make some progress with this bug report?

> Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
> From: Pengji Zhang <me <at> pengjiz.com>
> Date: Thu, 14 Nov 2024 19:18:20 +0800
> 
> Spencer Baugh <sbaugh <at> janestreet.com> writes:
> 
> > I think this should also switch from passing "-Q" to passing just
> > "-q". If we're include ~/.emacs.d/elpa on load-path, we should include
> > the site-lisp directories too, which -Q suppresses.
> 
> I agree. How about the following change?
> 
> --8<---------------cut here---------------start------------->8---
>          :name "elisp-flymake-byte-compile"
>          :buffer output-buffer
>          :command `(,(expand-file-name invocation-name invocation-directory)
> -                   "-Q"
> +                   ,@(if elisp-flymake--byte-compile-activate-packages
> +                         ;; Add site-lisp directories to `load-path' so
> +                         ;; that system-wide packages (installed into
> +                         ;; site-lisp/elpa) are activated.
> +                         '("-q" "--no-site-file")
> +                       '("-Q"))
>                     "--batch"
>                     ;; "--eval" "(setq load-prefer-newer t)" ; for testing
>                     ,@(mapcan (lambda (path) (list "-L" path))
> --8<---------------cut here---------------end--------------->8---
> 
> > Probably we should specifically pass "--batch --no-site-file" instead
> > of "-Q --batch", since --batch also implies -q.
> 
> I am not sure if it is a good idea to always include the site-lisp
> directories. I myself want this only when checking my init.el. When
> developing packages, I prefer a pristine environment.
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Sat, 14 Dec 2024 09:35:02 GMT) Full text and rfc822 format available.

Message #38 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: sbaugh <at> janestreet.com
Cc: 65035 <at> debbugs.gnu.org, joaotavora <at> gmail.com, me <at> pengjiz.com
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Sat, 14 Dec 2024 11:33:58 +0200
Ping! Ping!

> Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
> Date: Sat, 30 Nov 2024 11:48:11 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> Ping!  Can we make some progress with this bug report?
> 
> > Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
> > From: Pengji Zhang <me <at> pengjiz.com>
> > Date: Thu, 14 Nov 2024 19:18:20 +0800
> > 
> > Spencer Baugh <sbaugh <at> janestreet.com> writes:
> > 
> > > I think this should also switch from passing "-Q" to passing just
> > > "-q". If we're include ~/.emacs.d/elpa on load-path, we should include
> > > the site-lisp directories too, which -Q suppresses.
> > 
> > I agree. How about the following change?
> > 
> > --8<---------------cut here---------------start------------->8---
> >          :name "elisp-flymake-byte-compile"
> >          :buffer output-buffer
> >          :command `(,(expand-file-name invocation-name invocation-directory)
> > -                   "-Q"
> > +                   ,@(if elisp-flymake--byte-compile-activate-packages
> > +                         ;; Add site-lisp directories to `load-path' so
> > +                         ;; that system-wide packages (installed into
> > +                         ;; site-lisp/elpa) are activated.
> > +                         '("-q" "--no-site-file")
> > +                       '("-Q"))
> >                     "--batch"
> >                     ;; "--eval" "(setq load-prefer-newer t)" ; for testing
> >                     ,@(mapcan (lambda (path) (list "-L" path))
> > --8<---------------cut here---------------end--------------->8---
> > 
> > > Probably we should specifically pass "--batch --no-site-file" instead
> > > of "-Q --batch", since --batch also implies -q.
> > 
> > I am not sure if it is a good idea to always include the site-lisp
> > directories. I myself want this only when checking my init.el. When
> > developing packages, I prefer a pristine environment.
> > 
> > 
> > 
> > 
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65035; Package emacs. (Sat, 28 Dec 2024 11:09:02 GMT) Full text and rfc822 format available.

Message #41 received at 65035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: sbaugh <at> janestreet.com
Cc: me <at> pengjiz.com, joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
Subject: Re: bug#65035: 29.1;
 Port flycheck-emacs-lisp-initialize-packages to flymake
Date: Sat, 28 Dec 2024 13:08:25 +0200
Ping! Ping! Ping!

> Cc: 65035 <at> debbugs.gnu.org, joaotavora <at> gmail.com, me <at> pengjiz.com
> Date: Sat, 14 Dec 2024 11:33:58 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> Ping! Ping!
> 
> > Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
> > Date: Sat, 30 Nov 2024 11:48:11 +0200
> > From: Eli Zaretskii <eliz <at> gnu.org>
> > 
> > Ping!  Can we make some progress with this bug report?
> > 
> > > Cc: joaotavora <at> gmail.com, 65035 <at> debbugs.gnu.org
> > > From: Pengji Zhang <me <at> pengjiz.com>
> > > Date: Thu, 14 Nov 2024 19:18:20 +0800
> > > 
> > > Spencer Baugh <sbaugh <at> janestreet.com> writes:
> > > 
> > > > I think this should also switch from passing "-Q" to passing just
> > > > "-q". If we're include ~/.emacs.d/elpa on load-path, we should include
> > > > the site-lisp directories too, which -Q suppresses.
> > > 
> > > I agree. How about the following change?
> > > 
> > > --8<---------------cut here---------------start------------->8---
> > >          :name "elisp-flymake-byte-compile"
> > >          :buffer output-buffer
> > >          :command `(,(expand-file-name invocation-name invocation-directory)
> > > -                   "-Q"
> > > +                   ,@(if elisp-flymake--byte-compile-activate-packages
> > > +                         ;; Add site-lisp directories to `load-path' so
> > > +                         ;; that system-wide packages (installed into
> > > +                         ;; site-lisp/elpa) are activated.
> > > +                         '("-q" "--no-site-file")
> > > +                       '("-Q"))
> > >                     "--batch"
> > >                     ;; "--eval" "(setq load-prefer-newer t)" ; for testing
> > >                     ,@(mapcan (lambda (path) (list "-L" path))
> > > --8<---------------cut here---------------end--------------->8---
> > > 
> > > > Probably we should specifically pass "--batch --no-site-file" instead
> > > > of "-Q --batch", since --batch also implies -q.
> > > 
> > > I am not sure if it is a good idea to always include the site-lisp
> > > directories. I myself want this only when checking my init.el. When
> > > developing packages, I prefer a pristine environment.
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 




This bug report was last modified 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.