From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master feb654b460: Add new package.el commands for recompilation Date: Thu, 16 Jun 2022 08:22:27 -0400 Message-ID: References: <165538015737.18417.15587779043841057948@vcs2.savannah.gnu.org> <20220616114917.A93A0C051C9@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11999"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 16 14:28:46 2022 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 1o1oc9-0002vo-2F for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 14:28:45 +0200 Original-Received: from localhost ([::1]:47338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1oc7-0007ye-Qr for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 08:28:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1oWG-0007o2-Mt for emacs-devel@gnu.org; Thu, 16 Jun 2022 08:22:40 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1oW9-00006R-Rg for emacs-devel@gnu.org; Thu, 16 Jun 2022 08:22:40 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 91B2F10060E; Thu, 16 Jun 2022 08:22:30 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1235B1004B2; Thu, 16 Jun 2022 08:22:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1655382149; bh=gpvr8eFzJKhku8zqf12Q1VCXoqBQSXg5Hq3I6HSdpn4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=g2K+3WqGD77JAltKlUObUguAYAOeUfgCl+/YJmBTHEUWyLeq0Jg93+kNdwV0eQtz+ 3Vi56Ser6g4G+fcgSJ52Kds54Fw+dXV6b65/tQnzosP/9RY2GF9LXXW8HugdaUQBw6 7tGuMCy3fPyBKl4L7hPIbdZ0ws5Us6YD0o5Su7qrCdxrgHWbm89tHUMbw3te5AVgQM BhcBivRvbYskCWhFW4wJW4eyyoEm6q2/2A5rl3itgN3gMSdez1EO9jAP5BIYti4J/J LvrtX5Zbw+7j5L1D/t8s4AT/Jih/eXTPi+u6uBSK+fsHlX70z3bKGsvwnpq6q0K8ln LwQmi2XeAXwJQ== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D8322120807; Thu, 16 Jun 2022 08:22:28 -0400 (EDT) In-Reply-To: <20220616114917.A93A0C051C9@vcs2.savannah.gnu.org> (Lars Ingebrigtsen's message of "Thu, 16 Jun 2022 07:49:17 -0400 (EDT)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 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" Xref: news.gmane.io gmane.emacs.devel:291239 Archived-At: > +;;;###autoload > +(defun package-recompile (pkg) > + "Byte-compile package PKG again. > +PKG should be either a symbol, the package name, or a `package-desc' > +object." > + (interactive (list (intern (completing-read > + "Recompile package: " > + (mapcar #'symbol-name > + (mapcar #'car package-alist)))))) > + (let ((pkg-desc (if (package-desc-p pkg) > + pkg > + (cadr (assq pkg package-alist))))) > + ;; Delete the old .elc files to ensure that we don't inadvertently > + ;; load them (in case they contain byte code/macros that are now > + ;; invalid). > + (dolist (elc (directory-files (package-desc-dir pkg-desc) t "\\.elc\\'")) > + (delete-file elc)) > + (package--compile pkg-desc))) Thanks, Lars. But note that there are packages with ELisp files in subdirectories (Hyperbole and Proof-General come to mind, tho I'm sure there are others) so we should work a bit harder than the above `directory-files`. Stefan