From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: Changes to make in elpa-packages file for nongnu elpa Date: Wed, 16 Aug 2023 11:55:13 +0000 Message-ID: <877cpvb361.fsf@posteo.net> References: <87r0oftgye.fsf@posteo.net> <87350vt1wz.fsf@posteo.net> <871qgen1ln.fsf@posteo.net> <87edke4mou.fsf@posteo.net> <87wmy6kuan.fsf@posteo.net> <87wmy6w070.fsf@posteo.net> <87zg2sjleg.fsf@posteo.net> <87pm3nlbm7.fsf@posteo.net> <87zg2ri9g9.fsf@posteo.net> <87bkf7b7ls.fsf@posteo.net> <87v8dfi6zy.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21476"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Thierry Volpiatto , Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 16 14:09:39 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWFLG-0005IR-7e for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Aug 2023 14:09:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWFKJ-0004Zz-L4; Wed, 16 Aug 2023 08:08:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWFKF-0004XX-D1 for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:08:35 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWFKC-0001Nt-C6 for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:08:35 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id D32F6240029 for ; Wed, 16 Aug 2023 14:08:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692187710; bh=oFAYsmD3YgkOlJXqfsO0KFjPU3XT+A+iI5FCqXmQIoY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=bmEGE2XQq038eELajVCW5KBPgUSIFsDsiE44gFG1QveTcKtz6oWOCIWC81eCmJFtz dag9yKaRwW4gisKPit+RueqgmS3pof/CwJQ6Z0B4bG5GDOWBJ4YB5/JyRuL+xvQ7pS ptBbaTTBdaziZmp5PgrVG+TpEY3n9LoWwI27HkRYwlEygX26Tc6lvKLU8xzscsPa6B Yyh3jrtlCwxwgyBKkFndS44OQBHfFcalfN//wBpyEd42o64OxieALGKsGnycRqqIoD LPG4nF7IjVLLc5yNheTe7YnViyDiDaCKHsXPINwfXnjo8UX+fN3cVSWbArrMJE19az TXZLLm/kn9nbQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RQn3F23vVz6v2P; Wed, 16 Aug 2023 14:08:25 +0200 (CEST) In-reply-to: <87v8dfi6zy.fsf@posteo.net> Received-SPF: pass client-ip=185.67.36.65; envelope-from=thievol@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308813 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Philip Kaludercic writes: > Thierry Volpiatto writes: > >> Philip Kaludercic writes: >> >>> Thierry Volpiatto writes: >>> >>>> Philip Kaludercic writes: >>>> >>>>> Philip Kaludercic writes: >>>>> >>>>>>>>> It is used specially for reproducing bugs in a clean environment,= see it >>>>>>>>> as emacs -Q for Emacs when reporting bugs. This script starts Ema= cs -Q >>>>>>>>> with only Helm loaded, this ensure the bug if one comes from Helm= and >>>>>>>>> not another package. This is important especially nowaday people = are >>>>>>>>> using "Emacs distribution" with the world list of packages instal= led. >>>>>>>>> Apart that the script is useful to quickly launch Emacs with helm= , one >>>>>>>>> can use it from the Helm directory or symlinked to e.g. ~/bin.=20 >>>>>>>> >>>>>>>> I see. In that case is there any reason you implement this as a s= hell >>>>>>>> script? >>>>>>> >>>>>>> Well when I wrote the script, packages where not existing and from >>>>>>> outside emacs it is actually the only way to run a package isolated. >>>>>>> >>>>>>>> (It might be interesting to provide something like this for >>>>>>>> package.el, to test packages in a generic way.) >>>>>>> >>>>>>> Yes, this would be interesting, it would be something like this: >>>>>>> >>>>>>> Emacs -Q >>>>>>> M-x >>>>>> packages nuisances> >>>>>> >>>>>> I was actually thinking of a command like >>>>>> >>>>>> M-x package-isolate RET foo,bar,baz RET >>>>>> >>>>>> and a new instance of Emacs using -Q is spun up, with all the packag= es >>>>>> you have listed loaded, and nothing else... Sounds like a fun little >>>>>> weekend project ;^) >>>>> >>>>> Here is my first attempt at providing this kind of a command. Any >>>>> comments? >>>> >>>> Why not reusing package.el functions? >>>> Why do you want to start in an isolated elpa directory? >>>> Isn't something like this suffice? (just missing to fallback to CRM wh= en >>>> helm is not available) >>> >>> I don't know much about Helm, but does it not support CRM? >> >> It does, but this is a much better interface than CRM. > > I don't think it makes sense to add support like this in the core, Perhaps yes. However it doesn't requires helm: (let ((helm-comp-read-use-marked t)) (if (and (boundp 'helm-mode) helm-mode) (completing-read ...) (completing-read-multiple ...) > but is there something we should keep in mind to not hinder > integration with Helm? No don't worry, helm will work in any cases, thanks. >>>> (defun package-isolate (packages) >>>> "Start an uncustomised Emacs and only load a set of PACKAGES." >>>> (interactive >>>> (list (let ((helm-comp-read-use-marked t)) >>>> (completing-read "Packages: " (mapcar #'car (package--a= list)))))) >>> >>> This doesn't allow selecting specific package versions, in case multiple >>> are installed (which might easily happen if you use package-vc). I >>> stole the code in my patch from package-delete, and I guess it would be >>> possible to generalise it into a utility function. >> >> Ok, I don't know much how package-vc works. > > I can have a classical tarball package installed next to a VC package, > just like you can have a built-in package or a system package, and it > makes sense to be able to decide which one to isolate. Ok, I understand. >>>> (let* ((name (concat "package-isolate-" (mapconcat #'identity >>>> packages ",")= )) >>> >>> This doesn't work, because the above returns a string, not a list of st= rings. >> >> No, it works, the above returns a list of strings (the completing-read >> allows marking and returns always a list). > > Not in my case, I got a type error. Yes, because the let-bounded var had no effect in your case, otherwise when helm is installed and helm-mode enabled the completing-read will always return a list. >>>> (deps (cl-loop for p in packages >>>> for sym =3D (intern p) >>>> append (package--dependencies sym)))) >>>> (apply #'start-process (concat "*" name "*") nil >>>> (list (file-truename (expand-file-name invocation-name = invocation-directory)) >>>> "--quick" "--debug-init" >>>> (format "--eval=3D%S" >>>> `(progn >>>> (require 'warnings) >>>> (add-to-list 'warning-suppress-log-type= s 'initialization) >>>> (require 'package) >>>> (setq package-load-list >>>> ',(append (mapcar (lambda (p) (list (i= ntern p) t)) packages) >>>> (mapcar (lambda (p) (list p = t)) deps))) >>>> (package-initialize))))))) >>> >>> This is actually a good idea, assuming there are no issues with lexical >>> scoping that might arise from --eval. I didn't think of using >>> package-load-list here, but it seems that this only works if we don't >>> add --init-directory, because otherwise the elpa/ directory is not >>> populated. >> >> Yes of course. >> >>> It seems to me, that for a proper isolated environment, we should add >>> a --init-directory option. >> >> Why as long as other directories in elpa are not in load-path? > > Mainly to avoid issues with packages that might place files in the > configuration directory, which might hinder the reproduction of bugs. Hmm, maybe, I don't have an example in mind though. > Upon reflection, my approach might have an issue if the user wishes to > install a package, for the sake of testing within the isolated > environment. Yes, one more reason to use the original elpa dir ;-) > Perhaps it would be better to set `package-directory-list' instead? Don't know yet. > Also, would it make sense to have some visual/textual indication that > this is a testing environment? Perhaps the *scratch* buffer string > could be modified or the default background colour could be set to > something else. No particular opinions about this. >>> This is easy to fix though, we just need to specify `package-user-dir' >>> at startup. Here is my updated patch, merging our approaches: >>> >>> [2. text/x-diff; >>> 0001-Add-command-to-start-Emacs-with-specific-packages.patch]... >>> >>> >>>>> [2. text/x-diff; >>>>> 0002-Add-command-to-start-Emacs-with-specific-packages.patch]... >>>>> >>>>> [3. text/x-diff; 0001-Add-a-function-to-query-the-Emacs-executable.pa= tch]... >>> >>> I have slightly modified your version, fixing issues I had, in case >>> anyone else wants to try it out: >> >> Thanks, sorry to not provide the CRM, I quickly wrote this. > > np. > >>> (defun package-isolate (packages) >>> "Start an uncustomised Emacs and only load a set of PACKAGES." >>> (interactive >>> (list (mapcar #'intern (completing-read-multiple "Packages: = " (mapcar #'car (package--alist)))))) >>> (let* ((name (concat "package-isolate-" (mapconcat #'symbol-n= ame packages ","))) >>> (deps (mapcan #'package--dependencies packages))) >>> (apply #'start-process (concat "*" name "*") nil >>> (list (file-truename (expand-file-name invocation-na= me invocation-directory)) >>> "--quick" "--debug-init" >>> (format "--eval=3D%S" >>> `(progn >>> (require 'warnings) >>> (add-to-list 'warning-suppress-log-= types 'initialization) >>> (require 'package) >>> (setq package-load-list >>> ',(mapcar (lambda (p) (list p= t)) (append packages deps))) >>> (package-initialize))))))) =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmTcvDYTHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk1THC/wNxzRzRcWKSOX2gG+BOJ/nt7KxcZsw 1giKsjmiBeSR1v1oHaSfZB6Khb1/o08/XwXi0IC9aTfPrrPBy+drqDC0zBA2qLUW p06PJIpeLOv/Dqbale8+Y4tfJFQ8h9vqc5if9hZ/5/iHY77jTq3ZO8GXaUODdjZi T74xUqjwcHCebMQA9us1yWynvMUCPj9ZSXSXRLGg7Z5W0rKODmbYs3gwSiP1e/Ym xQJ0AJg85kFamRPh7WiemiG5sBPQozdcLQWGUXy+vixop3csjVUu8lSNM9ubchZO TV2bYOIhiBPZaDMEU4nCml0H+OUEEYr5BAm8tLcr82AM2YdrCzjPvIdUH2KXbBJ8 PHDFsNIqJeR0ndhCwy8B1fxe4y8TWKQeLTYGo/Jp9IGA3Gb2SCbfPln/q7Z3V9eO koB3RxtmvvBQlaLKZl1jEfC4P3TV+MeLVfqr4ImhceR+ioCikHkzwoimiaBfKOLd BvJOaiEVMhRiQqj7VnidVCkmUmjQf/dOy8o= =vWve -----END PGP SIGNATURE----- --=-=-=--