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

From: Stefan Kangas <[email-masked]>
Date: Thu, 29 Apr 2021 16:59:44 -0500

Severity: wishlist

Please consider adding a function and/or command to clear the eln
cache of redundant eln cache directories.

The exact details of this would of course need to be discussed, but as
a starting point perhaps we could imagine two modes of operation:

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.

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.

We could add a number of options to ensure a user can tweak this to
their own liking.

One idea for a command name is `native-compile-cache-clear'.