On Thu, Jun 16, 2022 at 8:29 AM Stefan Monnier wrote: > > +;;;###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`. > > The realgud family of packages employs a (single-file) package load-relative to manage a fairly large number of elisp files, including munging the feature symbol. Looking at my 1000+ package sample, I see the following appear to have more mundane occurrences of elisp file in subdirectories: - all-the-icons - auctex - axiom-environment - ecb - elisp-benchmarks - elpy (.yas-setup.el) - ert-runner - irony (tests) - julia-snail - parser-generator (tests) - requirejs (.yas-compiled-snippets.el) - slime - sly - taxy (examples) - yasnippet-snippets (.yas-setup.el)