list-packages prompts you to upgrade packages when newer versions are available. How do you tell
package.el to never consider a particular package for auto-upgrades? There are some packages which I have minor customizations for and don't care about newer versions of them.
Add the following code to your init-file (replace
package-2, etc. with names of packages you would like to freeze at the current version):
(defvar package-menu-exclude-packages '("package-1" "package-2" "package-n")) (defun package-menu--remove-excluded-packages (orig) (let ((included (-filter (lambda (entry) (let ((name (symbol-name (package-desc-name (car entry))))) (not (member name package-menu-exclude-packages)))) tabulated-list-entries))) (setq-local tabulated-list-entries included) (funcall orig))) (advice-add 'package-menu--find-upgrades :around #'package-menu--remove-excluded-packages)
package-menu--find-upgrades is responsible for building the list of packages to upgrade. To do this, it looks at each entry in
tabulated-list-entries. So in order to ignore certain packages, we need to:
Introduce a variable that holds a list of packages to ignore (called
package-menu--find-upgradesto run with a modified version of
tabulated-list-entriesthat excludes the packages we'd like to ignore.