Created
September 12, 2011 16:11
-
-
Save milkypostman/1211655 to your computer and use it in GitHub Desktop.
Function to update all packages in package.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun package-update-all () | |
"Update all packages" | |
(interactive) | |
(dolist (elt package-alist) | |
(let* ((name (car elt)) | |
(file-name (symbol-name name)) | |
(available-pkg (assq name package-archive-contents)) | |
(available-version (and available-pkg | |
(package-desc-vers (cdr available-pkg)))) | |
(current-version (package-desc-vers (cdr elt))) | |
) | |
(when (and available-version | |
(version-list-< current-version available-version)) | |
(message "Updating to: %s-%s" file-name | |
(package-version-join available-version)) | |
(package-install name) | |
(package-delete file-name (package-version-join current-version)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment