use-package icon indicating copy to clipboard operation
use-package copied to clipboard

Programmatic package deletion

Open omsai opened this issue 6 years ago • 2 comments

Can we add support for non-interactively running package-autoremove?

I use the auto-package-update package and every few weeks I run into problems with old, stale packages conflicting with newer packages and have to delete the older packages. Of course, package-autoremove makes it easy for me to get rid of old packages, however it is interactive and I would like to have the the function to silently work in my .emacs startup file instead of prompting me to delete packages, so that I can have it run with emacs server.

omsai avatar Jun 20 '19 23:06 omsai

just add (auto-package-update-maybe) on your .emacs is sufficient?

conao3 avatar Feb 22 '21 16:02 conao3

@conao3 Thank you for the suggestion! I was using (auto-package-update-maybe) but neglected to show that in my first post:


(require 'package)
(package-initialize)
(if (not (package-installed-p 'use-package))
    (progn
      (package-refresh-contents)
      (package-install 'use-package)))
(require 'use-package)
(defun has-no-internet ()
  "Return non-nil if no internet."
  (not (equal 0 (call-process "ping" nil nil nil "-c" "1" "-W" "1" "eff.org"))))
(unless (has-no-internet)
  (setq use-package-compute-statistics t)
  (setq use-package-always-ensure t)
  (use-package auto-package-update
    :ensure t
    :config
    (setq auto-package-update-delete-old-versions t)
    (setq auto-package-update-hide-results t)
    (auto-package-update-maybe)))

The full configuration is here: https://gitlab.com/omsai/dotfiles/-/blob/master/emacs/.emacs

omsai avatar Feb 23 '21 11:02 omsai

I think this is outside the scope of use-package, to be honest. To automatically update packages, you would want to use something like https://github.com/rranelli/auto-package-update.el, or if that doesn't work make a feature request for package.el.

I'm therefore closing this issue as wontfix.

skangas avatar Dec 02 '22 15:12 skangas