aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Malabarba2015-05-26 09:57:17 +0100
committerArtur Malabarba2015-05-27 20:42:29 +0100
commit1f7abd04bc695c86dc6b8ee5ad88c7639c2c8868 (patch)
treed263f64355305346df784bfa0d60372287660c2e
parentf9fabb2bb099d944cc97a87933b86b9eae02d067 (diff)
downloademacs-1f7abd04bc695c86dc6b8ee5ad88c7639c2c8868.tar.gz
emacs-1f7abd04bc695c86dc6b8ee5ad88c7639c2c8868.zip
* lisp/emacs-lisp/package.el: Don't erase tags on refresh
(package-menu--post-refresh): Call `tabulated-list-print' with the UPDATE argument. This only affects the refresh action, the revert action still erases tags. (package-menu-get-status): Change `assq' to `assoc'. (package-menu--mark-upgrades-1): New function. (package-menu--mark-upgrades-pending): New variable. (package-menu-mark-upgrades): Use them to delay marking until after refresh is done. (package-menu--post-refresh): Call mark-upgrades-1 if mark-upgrades-pending is non-nil.
-rw-r--r--lisp/emacs-lisp/package.el41
1 files changed, 30 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index b96518df502..3d5afa3edd2 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2811,7 +2811,7 @@ The full list of keys can be viewed with \\[describe-mode]."
2811 2811
2812(defun package-menu-get-status () 2812(defun package-menu-get-status ()
2813 (let* ((id (tabulated-list-get-id)) 2813 (let* ((id (tabulated-list-get-id))
2814 (entry (and id (assq id tabulated-list-entries)))) 2814 (entry (and id (assoc id tabulated-list-entries))))
2815 (if entry 2815 (if entry
2816 (aref (cadr entry) 2) 2816 (aref (cadr entry) 2)
2817 ""))) 2817 "")))
@@ -2855,15 +2855,15 @@ consideration."
2855 (push (cons name avail-pkg) upgrades)))) 2855 (push (cons name avail-pkg) upgrades))))
2856 upgrades)) 2856 upgrades))
2857 2857
2858(defun package-menu-mark-upgrades () 2858(defvar package-menu--mark-upgrades-pending nil
2859 "Whether mark-upgrades is waiting for a refresh to finish.")
2860
2861(defun package-menu--mark-upgrades-1 ()
2859 "Mark all upgradable packages in the Package Menu. 2862 "Mark all upgradable packages in the Package Menu.
2860For each installed package with a newer version available, place 2863Implementation of `package-menu-mark-upgrades'."
2861an (I)nstall flag on the available version and a (D)elete flag on
2862the installed version. A subsequent \\[package-menu-execute]
2863call will upgrade the package."
2864 (interactive)
2865 (unless (derived-mode-p 'package-menu-mode) 2864 (unless (derived-mode-p 'package-menu-mode)
2866 (error "The current buffer is not a Package Menu")) 2865 (error "The current buffer is not a Package Menu"))
2866 (setq package-menu--mark-upgrades-pending nil)
2867 (let ((upgrades (package-menu--find-upgrades))) 2867 (let ((upgrades (package-menu--find-upgrades)))
2868 (if (null upgrades) 2868 (if (null upgrades)
2869 (message "No packages to upgrade.") 2869 (message "No packages to upgrade.")
@@ -2880,8 +2880,24 @@ call will upgrade the package."
2880 (t 2880 (t
2881 (package-menu-mark-delete)))))) 2881 (package-menu-mark-delete))))))
2882 (message "%d package%s marked for upgrading." 2882 (message "%d package%s marked for upgrading."
2883 (length upgrades) 2883 (length upgrades)
2884 (if (= (length upgrades) 1) "" "s"))))) 2884 (if (= (length upgrades) 1) "" "s")))))
2885
2886(defun package-menu-mark-upgrades ()
2887 "Mark all upgradable packages in the Package Menu.
2888For each installed package with a newer version available, place
2889an (I)nstall flag on the available version and a (D)elete flag on
2890the installed version. A subsequent \\[package-menu-execute]
2891call will upgrade the package.
2892
2893If there's an async refresh operation in progress, the flags will
2894be placed as part of `package-menu--post-refresh' instead of
2895immediately."
2896 (interactive)
2897 (if (not package--downloads-in-progress)
2898 (package-menu--mark-upgrades-1)
2899 (setq package-menu--mark-upgrades-pending t)
2900 (message "Waiting for refresh to finish...")))
2885 2901
2886(defun package-menu--list-to-prompt (packages) 2902(defun package-menu--list-to-prompt (packages)
2887 "Return a string listing PACKAGES that's usable in a prompt. 2903 "Return a string listing PACKAGES that's usable in a prompt.
@@ -3099,8 +3115,11 @@ after `package-menu--perform-transaction'."
3099 (let ((buf (get-buffer "*Packages*"))) 3115 (let ((buf (get-buffer "*Packages*")))
3100 (when (buffer-live-p buf) 3116 (when (buffer-live-p buf)
3101 (with-current-buffer buf 3117 (with-current-buffer buf
3102 (revert-buffer nil 'noconfirm)))) 3118 (run-hooks 'tabulated-list-revert-hook)
3103 (package-menu--find-and-notify-upgrades)) 3119 (tabulated-list-print 'remember 'update)
3120 (if package-menu--mark-upgrades-pending
3121 (package-menu--mark-upgrades-1)
3122 (package-menu--find-and-notify-upgrades))))))
3104 3123
3105;;;###autoload 3124;;;###autoload
3106(defun list-packages (&optional no-fetch) 3125(defun list-packages (&optional no-fetch)