Add native-compile-prune-cache command
* lisp/emacs-lisp/comp.el (native-compile-prune-cache): New command (bug#48108).
This commit is contained in:
parent
14d4d63c8c
commit
05d240997a
2 changed files with 32 additions and 1 deletions
|
@ -4288,6 +4288,30 @@ of (commands) to run simultaneously."
|
|||
(let ((load (not (not load))))
|
||||
(native--compile-async files recursively load selector)))
|
||||
|
||||
(defun native-compile-prune-cache ()
|
||||
"Remove .eln files that aren't applicable to the current Emacs invocation."
|
||||
(interactive)
|
||||
(dolist (dir native-comp-eln-load-path)
|
||||
;; If a directory is non absolute it is assumed to be relative to
|
||||
;; `invocation-directory'.
|
||||
(setq dir (expand-file-name dir invocation-directory))
|
||||
(when (file-exists-p dir)
|
||||
(dolist (subdir (directory-files dir t))
|
||||
(when (and (file-directory-p subdir)
|
||||
(file-writable-p subdir)
|
||||
(not (equal (file-name-nondirectory
|
||||
(directory-file-name subdir))
|
||||
comp-native-version-dir)))
|
||||
(message "Deleting %s..." subdir)
|
||||
;; We're being overly cautious here -- there shouldn't be
|
||||
;; anything but .eln files in these directories.
|
||||
(dolist (eln (directory-files subdir t "\\.eln\\(\\.tmp\\)?\\'"))
|
||||
(when (file-writable-p eln)
|
||||
(delete-file eln)))
|
||||
(when (directory-empty-p subdir)
|
||||
(delete-directory subdir))))))
|
||||
(message "Cache cleared"))
|
||||
|
||||
(provide 'comp)
|
||||
|
||||
;; LocalWords: limplified limplified limplification limplify Limple LIMPLE libgccjit elc eln
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue