¿Cómo decide package-autoremove qué paquetes eliminar?


Con frecuencia, cuando actualizo mis paquetes actuales, se me solicita que ejecute package-autoremove, que pretende eliminar paquetes obsoletos o innecesarios. Sin embargo, siempre parece eliminar (junto con esos paquetes obsoletos) dos paquetes que sí uso (a saber, aurora-theme, mi tema actual de elección y dired +).

Me temo que soy un poco novato en lo que respecta a Emacs-Lisp y me preguntaba si había alguna manera de detener la eliminación automática de paquetes eliminando estos paquetes para no tener que volver a instalarlos.


La fuente está aquí: https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/package.el#L2113 .

Elimina todos los paquetes que no están en package-selected-packages ni en una dependencia.

(defun package-autoremove ()
"Remove packages that are no more needed.
        Packages that are no more needed by other packages in
        `package-selected-packages' and their dependencies
        will be deleted."
;; If `package-selected-packages' is nil, it would make no sense to
;; try to populate it here, because then `package-autoremove' will
;; do absolutely nothing.
(when (or package-selected-packages
            "`package-selected-packages' is empty! Really remove ALL packages? ")))
    (let ((removable (package--removable-packages)))
    (if removable
        (when (y-or-n-p
                (format "%s packages will be deleted:\n%s, proceed? "
                        (length removable)
                        (mapconcat #'symbol-name removable ", ")))
            (mapc (lambda (p)
                    (package-delete (cadr (assq p package-alist)) t))
        (message "Nothing to autoremove")))))

(defun package--removable-packages ()
  "Return a list of names of packages no longer needed.
These are packages which are neither contained in
`package-selected-packages' nor a dependency of one that is."
  (let ((needed (cl-loop for p in package-selected-packages
                         if (assq p package-alist)
                         ;; `p' and its dependencies are needed.
                         append (cons p (package--get-deps p)))))
    (cl-loop for p in (mapcar #'car package-alist)
             unless (memq p needed)
             collect p)))

Leave a Comment

Your email address will not be published.

Scroll to Top

istanbul avukat


web tasarım