* Re: master 05d240997a 2/2: Add native-compile-prune-cache command [not found] ` <20220702105957.4B7EFC016B5@vcs2.savannah.gnu.org> @ 2022-07-22 8:51 ` Robert Pluim 2022-07-22 12:29 ` Stefan Monnier ` (2 more replies) 0 siblings, 3 replies; 30+ messages in thread From: Robert Pluim @ 2022-07-22 8:51 UTC (permalink / raw) To: emacs-devel; +Cc: Lars Ingebrigtsen >>>>> On Sat, 2 Jul 2022 06:59:56 -0400 (EDT), Lars Ingebrigtsen <larsi@gnus.org> said: Lars> branch: master Lars> commit 05d240997aeb6ffe3db21e7f4c8e2f181edc37b6 Lars> Author: Lars Ingebrigtsen <larsi@gnus.org> Lars> Commit: Lars Ingebrigtsen <larsi@gnus.org> Lars> Add native-compile-prune-cache command Lars> * lisp/emacs-lisp/comp.el (native-compile-prune-cache): New Lars> command (bug#48108). Should we wrap this (and perhaps `startup-redirect-eln-cache') in (when native-comp-available-p) ? In a non-native compile Emacs they signal an error: Debugger entered--Lisp error: (void-variable native-comp-eln-load-path) (let ((--dolist-tail-- native-comp-eln-load-path)) (while --dolist-tail-- (let ((dir (car --dolist-tail--))) (setq dir (expand-file-name dir invocation-directory)) (if (file-exists-p dir) (progn (let ((--dolist-tail-- ...)) (while --dolist-tail-- (let ... ... ...))))) (setq --dolist-tail-- (cdr --dolist-tail--))))) native-compile-prune-cache() eval((native-compile-prune-cache) t) eval-expression((native-compile-prune-cache) nil nil 4194303) funcall-interactively(eval-expression (native-compile-prune-cache) nil nil 4194303) call-interactively(eval-expression nil nil) command-execute(eval-expression) Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 8:51 ` master 05d240997a 2/2: Add native-compile-prune-cache command Robert Pluim @ 2022-07-22 12:29 ` Stefan Monnier 2022-07-22 12:45 ` Andrea Corallo 2022-07-22 19:56 ` Lars Ingebrigtsen 2 siblings, 0 replies; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 12:29 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel, Lars Ingebrigtsen > Debugger entered--Lisp error: (void-variable native-comp-eln-load-path) BTW, I think we should try to make those native-compile-only functions and variables usable when native-compile is not included. E.g. native-comp-eln-load-path could simply be nil in such builds. Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 8:51 ` master 05d240997a 2/2: Add native-compile-prune-cache command Robert Pluim 2022-07-22 12:29 ` Stefan Monnier @ 2022-07-22 12:45 ` Andrea Corallo 2022-07-22 13:01 ` Robert Pluim 2022-07-22 19:46 ` Stefan Monnier 2022-07-22 19:56 ` Lars Ingebrigtsen 2 siblings, 2 replies; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 12:45 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel, Lars Ingebrigtsen Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Sat, 2 Jul 2022 06:59:56 -0400 (EDT), Lars Ingebrigtsen <larsi@gnus.org> said: > > Lars> branch: master > Lars> commit 05d240997aeb6ffe3db21e7f4c8e2f181edc37b6 > Lars> Author: Lars Ingebrigtsen <larsi@gnus.org> > Lars> Commit: Lars Ingebrigtsen <larsi@gnus.org> > > Lars> Add native-compile-prune-cache command > > Lars> * lisp/emacs-lisp/comp.el (native-compile-prune-cache): New > Lars> command (bug#48108). > > > Should we wrap this (and perhaps `startup-redirect-eln-cache') in > (when native-comp-available-p) ? In a non-native compile Emacs they > signal an error: Hi Robert, do we support loading comp.el and using in non native builds? I thought is not the case, because otherwise most of the functions there ATM are probably broken for such a build no? Thanks Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 12:45 ` Andrea Corallo @ 2022-07-22 13:01 ` Robert Pluim 2022-07-22 13:51 ` Andrea Corallo 2022-07-22 19:46 ` Stefan Monnier 1 sibling, 1 reply; 30+ messages in thread From: Robert Pluim @ 2022-07-22 13:01 UTC (permalink / raw) To: Andrea Corallo; +Cc: emacs-devel, Lars Ingebrigtsen >>>>> On Fri, 22 Jul 2022 12:45:03 +0000, Andrea Corallo <akrl@sdf.org> said: >> Should we wrap this (and perhaps `startup-redirect-eln-cache') in >> (when native-comp-available-p) ? In a non-native compile Emacs they >> signal an error: Andrea> Hi Robert, Andrea> do we support loading comp.el and using in non native builds? (require 'comp) certainly works (although youʼre right, the functions in comp.el are not available by default, which means I must have loaded comp.el myself at some point). Andrea> I thought is not the case, because otherwise most of the functions there Andrea> ATM are probably broken for such a build no? Right. The question is if we want to support such a case (and if so, exactly how). Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 13:01 ` Robert Pluim @ 2022-07-22 13:51 ` Andrea Corallo 2022-07-22 14:15 ` Robert Pluim 0 siblings, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 13:51 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel, Lars Ingebrigtsen Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Fri, 22 Jul 2022 12:45:03 +0000, Andrea Corallo <akrl@sdf.org> said: > >> Should we wrap this (and perhaps `startup-redirect-eln-cache') in > >> (when native-comp-available-p) ? In a non-native compile Emacs they > >> signal an error: > > Andrea> Hi Robert, > > Andrea> do we support loading comp.el and using in non native builds? > > (require 'comp) > > certainly works (although youʼre right, the functions > in comp.el are not available by default, which means I must have > loaded comp.el myself at some point). > > Andrea> I thought is not the case, because otherwise most of the functions there > Andrea> ATM are probably broken for such a build no? > > Right. The question is if we want to support such a case (and if so, > exactly how). Yep, I really thought the answer was no, at least for now, but I might be wrong. BTW assuming the answer is no, should we add a load time check with associated error or warning for comp.el to gate all these possible issues? Thanks! Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 13:51 ` Andrea Corallo @ 2022-07-22 14:15 ` Robert Pluim 2022-07-22 15:14 ` Andrea Corallo 2022-07-22 19:47 ` Stefan Monnier 0 siblings, 2 replies; 30+ messages in thread From: Robert Pluim @ 2022-07-22 14:15 UTC (permalink / raw) To: Andrea Corallo; +Cc: emacs-devel, Lars Ingebrigtsen >>>>> On Fri, 22 Jul 2022 13:51:04 +0000, Andrea Corallo <akrl@sdf.org> said: >> Right. The question is if we want to support such a case (and if so, >> exactly how). Andrea> Yep, I really thought the answer was no, at least for now, but I might Andrea> be wrong. Andrea> BTW assuming the answer is no, should we add a load time check with Andrea> associated error or warning for comp.el to gate all these possible Andrea> issues? Iʼd lean towards a warning myself (both for loading and for running any of the commands inside comp.el) Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 14:15 ` Robert Pluim @ 2022-07-22 15:14 ` Andrea Corallo 2022-07-22 15:36 ` Robert Pluim 2022-07-22 19:47 ` Stefan Monnier 1 sibling, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 15:14 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel, Lars Ingebrigtsen Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Fri, 22 Jul 2022 13:51:04 +0000, Andrea Corallo <akrl@sdf.org> said: > >> Right. The question is if we want to support such a case (and if so, > >> exactly how). > > Andrea> Yep, I really thought the answer was no, at least for now, but I might > Andrea> be wrong. > > Andrea> BTW assuming the answer is no, should we add a load time check with > Andrea> associated error or warning for comp.el to gate all these possible > Andrea> issues? > > Iʼd lean towards a warning myself (both for loading and for running > any of the commands inside comp.el) FWIW I'd probably go just for the load-time warning. I fear gating every function would probably bloat the code for not getting much back. Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:14 ` Andrea Corallo @ 2022-07-22 15:36 ` Robert Pluim 2022-07-22 15:41 ` Eli Zaretskii 2022-07-22 16:50 ` Andrea Corallo 0 siblings, 2 replies; 30+ messages in thread From: Robert Pluim @ 2022-07-22 15:36 UTC (permalink / raw) To: Andrea Corallo; +Cc: emacs-devel, Lars Ingebrigtsen >>>>> On Fri, 22 Jul 2022 15:14:21 +0000, Andrea Corallo <akrl@sdf.org> said: Andrea> Robert Pluim <rpluim@gmail.com> writes: >>>>>>> On Fri, 22 Jul 2022 13:51:04 +0000, Andrea Corallo <akrl@sdf.org> said: >> >> Right. The question is if we want to support such a case (and if so, >> >> exactly how). >> Andrea> Yep, I really thought the answer was no, at least for now, but I might Andrea> be wrong. >> Andrea> BTW assuming the answer is no, should we add a load time check with Andrea> associated error or warning for comp.el to gate all these possible Andrea> issues? >> >> Iʼd lean towards a warning myself (both for loading and for running >> any of the commands inside comp.el) Andrea> FWIW I'd probably go just for the load-time warning. I fear gating Andrea> every function would probably bloat the code for not getting much back. Something like this (untested) in `normal-top-level'? (unless (featurep 'native-compile) (with-eval-after-load 'comp (display-warning 'comp "This emacs does not support native compilation" :warning))) Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:36 ` Robert Pluim @ 2022-07-22 15:41 ` Eli Zaretskii 2022-07-22 15:46 ` Robert Pluim 2022-07-22 16:50 ` Andrea Corallo 1 sibling, 1 reply; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 15:41 UTC (permalink / raw) To: Robert Pluim; +Cc: akrl, emacs-devel, larsi > From: Robert Pluim <rpluim@gmail.com> > Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> > Date: Fri, 22 Jul 2022 17:36:16 +0200 > > Something like this (untested) in `normal-top-level'? > > (unless (featurep 'native-compile) > (with-eval-after-load 'comp > (display-warning 'comp "This emacs does not support native compilation" :warning))) Why do we need this, again? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:41 ` Eli Zaretskii @ 2022-07-22 15:46 ` Robert Pluim 2022-07-22 16:18 ` Eli Zaretskii 2022-07-22 19:49 ` Stefan Monnier 0 siblings, 2 replies; 30+ messages in thread From: Robert Pluim @ 2022-07-22 15:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: akrl, emacs-devel, larsi >>>>> On Fri, 22 Jul 2022 18:41:09 +0300, Eli Zaretskii <eliz@gnu.org> said: >> From: Robert Pluim <rpluim@gmail.com> >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> >> Date: Fri, 22 Jul 2022 17:36:16 +0200 >> >> Something like this (untested) in `normal-top-level'? >> >> (unless (featurep 'native-compile) >> (with-eval-after-load 'comp >> (display-warning 'comp "This emacs does not support native compilation" :warning))) Eli> Why do we need this, again? I had comp.el loaded in my non-native compile capable Emacs, and tried to run `native-compile-prune-cacheʼ, which gave me an error. Either we accept that I did something that shouldnʼt be done, or we try to warn people that they shouldnʼt do it (or on the gripping hand we add code to check 'native-compile to a bunch of stuff in comp.el). Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:46 ` Robert Pluim @ 2022-07-22 16:18 ` Eli Zaretskii 2022-07-22 16:41 ` Robert Pluim 2022-07-22 16:42 ` Andreas Schwab 2022-07-22 19:49 ` Stefan Monnier 1 sibling, 2 replies; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 16:18 UTC (permalink / raw) To: Robert Pluim; +Cc: akrl, emacs-devel, larsi > From: Robert Pluim <rpluim@gmail.com> > Cc: akrl@sdf.org, emacs-devel@gnu.org, larsi@gnus.org > Date: Fri, 22 Jul 2022 17:46:07 +0200 > > >>>>> On Fri, 22 Jul 2022 18:41:09 +0300, Eli Zaretskii <eliz@gnu.org> said: > > >> From: Robert Pluim <rpluim@gmail.com> > >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> > >> Date: Fri, 22 Jul 2022 17:36:16 +0200 > >> > >> Something like this (untested) in `normal-top-level'? > >> > >> (unless (featurep 'native-compile) > >> (with-eval-after-load 'comp > >> (display-warning 'comp "This emacs does not support native compilation" :warning))) > > Eli> Why do we need this, again? > > I had comp.el loaded in my non-native compile capable Emacs, and tried > to run `native-compile-prune-cacheʼ, which gave me an error. Either we > accept that I did something that shouldnʼt be done, or we try to warn > people that they shouldnʼt do it (or on the gripping hand we add code > to check 'native-compile to a bunch of stuff in comp.el). What would be the reason to load comp.el in such a session? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 16:18 ` Eli Zaretskii @ 2022-07-22 16:41 ` Robert Pluim 2022-07-22 18:03 ` Eli Zaretskii 2022-07-22 16:42 ` Andreas Schwab 1 sibling, 1 reply; 30+ messages in thread From: Robert Pluim @ 2022-07-22 16:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: akrl, emacs-devel, larsi >>>>> On Fri, 22 Jul 2022 19:18:19 +0300, Eli Zaretskii <eliz@gnu.org> said: >> From: Robert Pluim <rpluim@gmail.com> >> Cc: akrl@sdf.org, emacs-devel@gnu.org, larsi@gnus.org >> Date: Fri, 22 Jul 2022 17:46:07 +0200 >> >> >>>>> On Fri, 22 Jul 2022 18:41:09 +0300, Eli Zaretskii <eliz@gnu.org> said: >> >> >> From: Robert Pluim <rpluim@gmail.com> >> >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> >> >> Date: Fri, 22 Jul 2022 17:36:16 +0200 >> >> >> >> Something like this (untested) in `normal-top-level'? >> >> >> >> (unless (featurep 'native-compile) >> >> (with-eval-after-load 'comp >> >> (display-warning 'comp "This emacs does not support native compilation" :warning))) >> Eli> Why do we need this, again? >> >> I had comp.el loaded in my non-native compile capable Emacs, and tried >> to run `native-compile-prune-cacheʼ, which gave me an error. Either we >> accept that I did something that shouldnʼt be done, or we try to warn >> people that they shouldnʼt do it (or on the gripping hand we add code >> to check 'native-compile to a bunch of stuff in comp.el). Eli> What would be the reason to load comp.el in such a session? User error. Some people might write (require ʼcomp) in their .emacs. Iʼm sure we can come up with lots of scenarios. Robert -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 16:41 ` Robert Pluim @ 2022-07-22 18:03 ` Eli Zaretskii 0 siblings, 0 replies; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 18:03 UTC (permalink / raw) To: Robert Pluim; +Cc: akrl, emacs-devel, larsi > From: Robert Pluim <rpluim@gmail.com> > Cc: akrl@sdf.org, emacs-devel@gnu.org, larsi@gnus.org > Date: Fri, 22 Jul 2022 18:41:40 +0200 > > >>>>> On Fri, 22 Jul 2022 19:18:19 +0300, Eli Zaretskii <eliz@gnu.org> said: > > >> From: Robert Pluim <rpluim@gmail.com> > >> Cc: akrl@sdf.org, emacs-devel@gnu.org, larsi@gnus.org > >> Date: Fri, 22 Jul 2022 17:46:07 +0200 > >> > >> >>>>> On Fri, 22 Jul 2022 18:41:09 +0300, Eli Zaretskii <eliz@gnu.org> said: > >> > >> >> From: Robert Pluim <rpluim@gmail.com> > >> >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> > >> >> Date: Fri, 22 Jul 2022 17:36:16 +0200 > >> >> > >> >> Something like this (untested) in `normal-top-level'? > >> >> > >> >> (unless (featurep 'native-compile) > >> >> (with-eval-after-load 'comp > >> >> (display-warning 'comp "This emacs does not support native compilation" :warning))) > >> > Eli> Why do we need this, again? > >> > >> I had comp.el loaded in my non-native compile capable Emacs, and tried > >> to run `native-compile-prune-cacheʼ, which gave me an error. Either we > >> accept that I did something that shouldnʼt be done, or we try to warn > >> people that they shouldnʼt do it (or on the gripping hand we add code > >> to check 'native-compile to a bunch of stuff in comp.el). > > Eli> What would be the reason to load comp.el in such a session? > > User error. Some people might write (require ʼcomp) in their > .emacs. Iʼm sure we can come up with lots of scenarios. If we want to handle user error of loading the file, then placing the code you suggested in comp.el itself would be TRT, I think. Not in startup.el. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 16:18 ` Eli Zaretskii 2022-07-22 16:41 ` Robert Pluim @ 2022-07-22 16:42 ` Andreas Schwab 2022-07-22 18:04 ` Eli Zaretskii 1 sibling, 1 reply; 30+ messages in thread From: Andreas Schwab @ 2022-07-22 16:42 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Robert Pluim, akrl, emacs-devel, larsi On Jul 22 2022, Eli Zaretskii wrote: > What would be the reason to load comp.el in such a session? Customize can do that. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 16:42 ` Andreas Schwab @ 2022-07-22 18:04 ` Eli Zaretskii 0 siblings, 0 replies; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 18:04 UTC (permalink / raw) To: Andreas Schwab; +Cc: rpluim, akrl, emacs-devel, larsi > From: Andreas Schwab <schwab@linux-m68k.org> > Cc: Robert Pluim <rpluim@gmail.com>, akrl@sdf.org, emacs-devel@gnu.org, > larsi@gnus.org > Date: Fri, 22 Jul 2022 18:42:28 +0200 > > On Jul 22 2022, Eli Zaretskii wrote: > > > What would be the reason to load comp.el in such a session? > > Customize can do that. In that case, I see no reason to produce any warnings. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:46 ` Robert Pluim 2022-07-22 16:18 ` Eli Zaretskii @ 2022-07-22 19:49 ` Stefan Monnier 1 sibling, 0 replies; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 19:49 UTC (permalink / raw) To: Robert Pluim; +Cc: Eli Zaretskii, akrl, emacs-devel, larsi > I had comp.el loaded in my non-native compile capable Emacs, and tried > to run `native-compile-prune-cacheʼ, which gave me an error. Let's fix it so it doesn't given an error, then. It could just give a warning if it's called interactively and there's no file to prune (that'd be useful also for builds *with* native compilation). Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 15:36 ` Robert Pluim 2022-07-22 15:41 ` Eli Zaretskii @ 2022-07-22 16:50 ` Andrea Corallo 2022-07-22 18:05 ` Eli Zaretskii 1 sibling, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 16:50 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel, Lars Ingebrigtsen [-- Attachment #1: Type: text/plain, Size: 1324 bytes --] Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Fri, 22 Jul 2022 15:14:21 +0000, Andrea Corallo <akrl@sdf.org> said: > > Andrea> Robert Pluim <rpluim@gmail.com> writes: > >>>>>>> On Fri, 22 Jul 2022 13:51:04 +0000, Andrea Corallo <akrl@sdf.org> said: > >> >> Right. The question is if we want to support such a case (and if so, > >> >> exactly how). > >> > Andrea> Yep, I really thought the answer was no, at least for now, but I might > Andrea> be wrong. > >> > Andrea> BTW assuming the answer is no, should we add a load time check with > Andrea> associated error or warning for comp.el to gate all these possible > Andrea> issues? > >> > >> Iʼd lean towards a warning myself (both for loading and for running > >> any of the commands inside comp.el) > > Andrea> FWIW I'd probably go just for the load-time warning. I fear gating > Andrea> every function would probably bloat the code for not getting much back. > > Something like this (untested) in `normal-top-level'? > > (unless (featurep 'native-compile) > (with-eval-after-load 'comp > (display-warning 'comp "This emacs does not support native compilation" :warning))) Yes something similar, wouldn't the attached be simpler? BR Andrea [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Warning-the-user-if-loading-comp-on-a-non-native-cap.patch --] [-- Type: text/x-diff, Size: 798 bytes --] From 81bfe715e2137f0572bb17a51bdac3e4f8cd106d Mon Sep 17 00:00:00 2001 From: Andrea Corallo <akrl@sdf.org> Date: Fri, 22 Jul 2022 18:46:33 +0200 Subject: [PATCH] * Warning the user if loading comp on a non native capable Emacs. * lisp/emacs-lisp/comp.el: Warning the user if loading on a non native capable Emacs. --- lisp/emacs-lisp/comp.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 9a635a4776..b9de0289ee 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -28,6 +28,10 @@ ;;; Code: +(unless (featurep 'native-compile) + (display-warning 'comp "This emacs does not support native compilation" + :warning)) + (require 'bytecomp) (require 'cl-extra) (require 'cl-lib) -- 2.25.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 16:50 ` Andrea Corallo @ 2022-07-22 18:05 ` Eli Zaretskii 2022-07-22 18:24 ` Andrea Corallo 0 siblings, 1 reply; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 18:05 UTC (permalink / raw) To: Andrea Corallo; +Cc: rpluim, emacs-devel, larsi > From: Andrea Corallo <akrl@sdf.org> > Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> > Date: Fri, 22 Jul 2022 16:50:24 +0000 > > > Something like this (untested) in `normal-top-level'? > > > > (unless (featurep 'native-compile) > > (with-eval-after-load 'comp > > (display-warning 'comp "This emacs does not support native compilation" :warning))) > > Yes something similar, wouldn't the attached be simpler? What will that do if comp.el is loaded by custom.el? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 18:05 ` Eli Zaretskii @ 2022-07-22 18:24 ` Andrea Corallo 2022-07-22 18:59 ` Eli Zaretskii 0 siblings, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 18:24 UTC (permalink / raw) To: Eli Zaretskii; +Cc: rpluim, emacs-devel, larsi Eli Zaretskii <eliz@gnu.org> writes: >> From: Andrea Corallo <akrl@sdf.org> >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> >> Date: Fri, 22 Jul 2022 16:50:24 +0000 >> >> > Something like this (untested) in `normal-top-level'? >> > >> > (unless (featurep 'native-compile) >> > (with-eval-after-load 'comp >> > (display-warning 'comp "This emacs does not support native compilation" :warning))) >> >> Yes something similar, wouldn't the attached be simpler? > > What will that do if comp.el is loaded by custom.el? AFAIU it should just emit the warning when comp.el is loaded. Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 18:24 ` Andrea Corallo @ 2022-07-22 18:59 ` Eli Zaretskii 2022-07-22 23:20 ` Andrea Corallo 0 siblings, 1 reply; 30+ messages in thread From: Eli Zaretskii @ 2022-07-22 18:59 UTC (permalink / raw) To: Andrea Corallo; +Cc: rpluim, emacs-devel, larsi > From: Andrea Corallo <akrl@sdf.org> > Cc: rpluim@gmail.com, emacs-devel@gnu.org, larsi@gnus.org > Date: Fri, 22 Jul 2022 18:24:51 +0000 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> From: Andrea Corallo <akrl@sdf.org> > >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> > >> Date: Fri, 22 Jul 2022 16:50:24 +0000 > >> > >> > Something like this (untested) in `normal-top-level'? > >> > > >> > (unless (featurep 'native-compile) > >> > (with-eval-after-load 'comp > >> > (display-warning 'comp "This emacs does not support native compilation" :warning))) > >> > >> Yes something similar, wouldn't the attached be simpler? > > > > What will that do if comp.el is loaded by custom.el? > > AFAIU it should just emit the warning when comp.el is loaded. Is that a good idea for such a scenario? Perhaps we should have a variable to inhibit the warning, which custom.el could bind? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 18:59 ` Eli Zaretskii @ 2022-07-22 23:20 ` Andrea Corallo 2022-07-22 23:41 ` Stefan Monnier 0 siblings, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 23:20 UTC (permalink / raw) To: Eli Zaretskii; +Cc: rpluim, emacs-devel, larsi Eli Zaretskii <eliz@gnu.org> writes: >> From: Andrea Corallo <akrl@sdf.org> >> Cc: rpluim@gmail.com, emacs-devel@gnu.org, larsi@gnus.org >> Date: Fri, 22 Jul 2022 18:24:51 +0000 >> >> Eli Zaretskii <eliz@gnu.org> writes: >> >> >> From: Andrea Corallo <akrl@sdf.org> >> >> Cc: emacs-devel@gnu.org, Lars Ingebrigtsen <larsi@gnus.org> >> >> Date: Fri, 22 Jul 2022 16:50:24 +0000 >> >> >> >> > Something like this (untested) in `normal-top-level'? >> >> > >> >> > (unless (featurep 'native-compile) >> >> > (with-eval-after-load 'comp >> >> > (display-warning 'comp "This emacs does not support native compilation" :warning))) >> >> >> >> Yes something similar, wouldn't the attached be simpler? >> > >> > What will that do if comp.el is loaded by custom.el? >> >> AFAIU it should just emit the warning when comp.el is loaded. > > Is that a good idea for such a scenario? I'm not sure why custom should load it (not a custom expert here), but assuming it is for making any use of it I'd say it is. Maybe an example of why custom should load comp would make my ideas more clear on this. Thanks Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 23:20 ` Andrea Corallo @ 2022-07-22 23:41 ` Stefan Monnier 2022-07-24 17:55 ` Andrea Corallo 0 siblings, 1 reply; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 23:41 UTC (permalink / raw) To: Andrea Corallo; +Cc: Eli Zaretskii, rpluim, emacs-devel, larsi > I'm not sure why custom should load it (not a custom expert here), but > assuming it is for making any use of it I'd say it is. > > Maybe an example of why custom should load comp would make my ideas more > clear on this. It's not just custom, there are all kinds of cases. E.g. earlier, I loaded `comp.elc` into my no-native-compiler Emacs session because I did `C-h o native-compile-prune-cache RET` which loaded the file to find the docstring. [ Actually, it loaded it before I hit RET, because I used completion, which triggered loading of `comp.elc` in order to provide completions for the `native-compile-` prefix. ] Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 23:41 ` Stefan Monnier @ 2022-07-24 17:55 ` Andrea Corallo 0 siblings, 0 replies; 30+ messages in thread From: Andrea Corallo @ 2022-07-24 17:55 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, rpluim, emacs-devel, larsi Stefan Monnier <monnier@iro.umontreal.ca> writes: >> I'm not sure why custom should load it (not a custom expert here), but >> assuming it is for making any use of it I'd say it is. >> >> Maybe an example of why custom should load comp would make my ideas more >> clear on this. > > It's not just custom, there are all kinds of cases. > E.g. earlier, I loaded `comp.elc` into my no-native-compiler Emacs > session because I did `C-h o native-compile-prune-cache RET` which loaded > the file to find the docstring. > [ Actually, it loaded it before I hit RET, because I used completion, > which triggered loading of `comp.elc` in order to provide completions > for the `native-compile-` prefix. ] I see, yeah than I defently agree we need to support loading comp.el also on a non native compiled Emacs. BTW, now that we have sympol positions, I'd like to extend comp.el for compile time analysis/diagnostic and this should be useful to all Emacs confs, so before or later loading (but also using) comp on all confs is probably something we might want to do. Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 14:15 ` Robert Pluim 2022-07-22 15:14 ` Andrea Corallo @ 2022-07-22 19:47 ` Stefan Monnier 1 sibling, 0 replies; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 19:47 UTC (permalink / raw) To: Robert Pluim; +Cc: Andrea Corallo, emacs-devel, Lars Ingebrigtsen > Iʼd lean towards a warning myself (both for loading and for running > any of the commands inside comp.el) Please don't warn when loading. There can be all kinds of valid reasons to load a file whose functions you have no intention to call. Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 12:45 ` Andrea Corallo 2022-07-22 13:01 ` Robert Pluim @ 2022-07-22 19:46 ` Stefan Monnier 2022-07-22 23:17 ` Andrea Corallo 1 sibling, 1 reply; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 19:46 UTC (permalink / raw) To: Andrea Corallo; +Cc: Robert Pluim, emacs-devel, Lars Ingebrigtsen > do we support loading comp.el and using in non native builds? We should support loading `comp.el`, yes. Using it (e.g. calling functions therein) probably not unless the call can be given a reasonable semantics. Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 19:46 ` Stefan Monnier @ 2022-07-22 23:17 ` Andrea Corallo 2022-07-22 23:38 ` Stefan Monnier 0 siblings, 1 reply; 30+ messages in thread From: Andrea Corallo @ 2022-07-22 23:17 UTC (permalink / raw) To: Stefan Monnier; +Cc: Robert Pluim, emacs-devel, Lars Ingebrigtsen Stefan Monnier <monnier@iro.umontreal.ca> writes: >> do we support loading comp.el and using in non native builds? > > We should support loading `comp.el`, yes. > Using it (e.g. calling functions therein) probably not unless the call > can be given a reasonable semantics. Sounds sensible, but then should we protect all functions or just say that using them not supported? Andrea ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 23:17 ` Andrea Corallo @ 2022-07-22 23:38 ` Stefan Monnier 2022-07-23 6:43 ` Eli Zaretskii 0 siblings, 1 reply; 30+ messages in thread From: Stefan Monnier @ 2022-07-22 23:38 UTC (permalink / raw) To: Andrea Corallo; +Cc: Robert Pluim, emacs-devel, Lars Ingebrigtsen Andrea Corallo [2022-07-22 23:17:44] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >>> do we support loading comp.el and using in non native builds? >> >> We should support loading `comp.el`, yes. >> Using it (e.g. calling functions therein) probably not unless the call >> can be given a reasonable semantics. > > Sounds sensible, but then should we protect all functions or just say > that using them not supported? I don't think we can/should have a general policy in this respect. I'd rather do it on a case-by-case basis. Regarding "prune cache" I earlier suggested that it could just "prune nothing" when called from an Emacs with no native-compiler, but I later saw that the docstring says: Remove .eln files that aren’t applicable to the current Emacs invocation. so another valid option would be for it to delete *all* the .eln files when called from an Emacs without support for native compilation (because none of the .eln files are "applicable to the current Emacs invocation"). Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 23:38 ` Stefan Monnier @ 2022-07-23 6:43 ` Eli Zaretskii 2022-07-23 13:47 ` Stefan Monnier 0 siblings, 1 reply; 30+ messages in thread From: Eli Zaretskii @ 2022-07-23 6:43 UTC (permalink / raw) To: Stefan Monnier; +Cc: akrl, rpluim, emacs-devel, larsi > From: Stefan Monnier <monnier@iro.umontreal.ca> > Cc: Robert Pluim <rpluim@gmail.com>, emacs-devel@gnu.org, Lars > Ingebrigtsen <larsi@gnus.org> > Date: Fri, 22 Jul 2022 19:38:09 -0400 > > Regarding "prune cache" I earlier suggested that it could just "prune > nothing" when called from an Emacs with no native-compiler, but I later > saw that the docstring says: > > Remove .eln files that aren’t applicable to the current Emacs invocation. > > so another valid option would be for it to delete *all* the .eln files > when called from an Emacs without support for native compilation > (because none of the .eln files are "applicable to the current Emacs > invocation"). I think this would be a very dangerous thing to do, especially if someone has more than one build of the same Emacs version on the system. (I also don't think it could be possible, because important variables needed by that function are undefined in such a build, which is IMO fortunate.) ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-23 6:43 ` Eli Zaretskii @ 2022-07-23 13:47 ` Stefan Monnier 0 siblings, 0 replies; 30+ messages in thread From: Stefan Monnier @ 2022-07-23 13:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: akrl, rpluim, emacs-devel, larsi > I think this would be a very dangerous thing to do, That's also my opinion, BTW :-) Stefan ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: master 05d240997a 2/2: Add native-compile-prune-cache command 2022-07-22 8:51 ` master 05d240997a 2/2: Add native-compile-prune-cache command Robert Pluim 2022-07-22 12:29 ` Stefan Monnier 2022-07-22 12:45 ` Andrea Corallo @ 2022-07-22 19:56 ` Lars Ingebrigtsen 2 siblings, 0 replies; 30+ messages in thread From: Lars Ingebrigtsen @ 2022-07-22 19:56 UTC (permalink / raw) To: Robert Pluim; +Cc: emacs-devel Robert Pluim <rpluim@gmail.com> writes: > Should we wrap this (and perhaps `startup-redirect-eln-cache') in > (when native-comp-available-p) ? In a non-native compile Emacs they > signal an error: > > Debugger entered--Lisp error: (void-variable native-comp-eln-load-path) > (let ((--dolist-tail-- native-comp-eln-load-path)) (while I've now improved the error message in native-compile-prune-cache. I don't think issuing warnings etc when loading comp.el in a non-nativecomp build is warranted -- you should always be able to load any .el file in any Emacs version without being bothered by things like that. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2022-07-24 17:55 UTC | newest] Thread overview: 30+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <165675959499.8421.12451308740112322312@vcs2.savannah.gnu.org> [not found] ` <20220702105957.4B7EFC016B5@vcs2.savannah.gnu.org> 2022-07-22 8:51 ` master 05d240997a 2/2: Add native-compile-prune-cache command Robert Pluim 2022-07-22 12:29 ` Stefan Monnier 2022-07-22 12:45 ` Andrea Corallo 2022-07-22 13:01 ` Robert Pluim 2022-07-22 13:51 ` Andrea Corallo 2022-07-22 14:15 ` Robert Pluim 2022-07-22 15:14 ` Andrea Corallo 2022-07-22 15:36 ` Robert Pluim 2022-07-22 15:41 ` Eli Zaretskii 2022-07-22 15:46 ` Robert Pluim 2022-07-22 16:18 ` Eli Zaretskii 2022-07-22 16:41 ` Robert Pluim 2022-07-22 18:03 ` Eli Zaretskii 2022-07-22 16:42 ` Andreas Schwab 2022-07-22 18:04 ` Eli Zaretskii 2022-07-22 19:49 ` Stefan Monnier 2022-07-22 16:50 ` Andrea Corallo 2022-07-22 18:05 ` Eli Zaretskii 2022-07-22 18:24 ` Andrea Corallo 2022-07-22 18:59 ` Eli Zaretskii 2022-07-22 23:20 ` Andrea Corallo 2022-07-22 23:41 ` Stefan Monnier 2022-07-24 17:55 ` Andrea Corallo 2022-07-22 19:47 ` Stefan Monnier 2022-07-22 19:46 ` Stefan Monnier 2022-07-22 23:17 ` Andrea Corallo 2022-07-22 23:38 ` Stefan Monnier 2022-07-23 6:43 ` Eli Zaretskii 2022-07-23 13:47 ` Stefan Monnier 2022-07-22 19:56 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.