emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master feb654b460: Add new package.el commands for recompilation


From: Stefan Monnier
Subject: Re: master feb654b460: Add new package.el commands for recompilation
Date: Thu, 16 Jun 2022 08:22:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> +;;;###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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]