Subject: bug#48108: Wishlist: Command to remove redundant eln cache directories [native-comp]

From: Eli Zaretskii <[email-masked]>
Date: Fri, 30 Apr 2021 10:59:37 +0300

> From: Stefan Kangas <[email-masked]>
> Date: Thu, 29 Apr 2021 16:59:44 -0500
> Cc: Andrea Corallo <[email-masked]>
> 
> 1.  Remove cache directories for versions older than the version
>     specified by a new user option that defaults to
>     (- emacs-major-version 2) or something.
> 
>     Remove cache directories for the same version as the current one
>     but with a different hash.
> 
>     Remove duplicate directories for any given version, except the
>     most recently added one.
> 
> 2.  Remove all eln cache directories except the one currently in use.

This is somewhat tricky, so I suggest that you (or someone else) comes
up with a convenient UI for such a feature and describes it in enough
detail to see whether it's feasible.  Namely, how would the user
indicate which *.eln files can be deleted and which should stay?

Some thought points:

  . the .eln hashes depend not only on the version but also on other
    internal details, like the ABI version and more
  . it isn't clear how the user will be able to come up with "the
    hash" (especially since there are several hashes involved, not
    just one)

> I imagine that casual users only ever use one version of Emacs at the
> same time (i.e. because they simply install Emacs using their package
> manager), so perhaps the first one could be the default mode of
> operation.

I don't know what you mean by "casual users", but I generally have all
the versions since Emacs 21 installed on my machines.

Btw, we might go look what others do with similar caches, for example
Guile.  Do they even bother to clean these caches up?