rranelli / auto-package-update.el

Automatically update Emacs packages.
151 stars 26 forks source link

auto-package-upgrade-count #26

Closed jwintz closed 7 years ago

jwintz commented 7 years ago

Hello,

First of all, your package is awesome. Just the functionality I looked for.

However, using spaceline, I would very much like to be able to define a segment with the number of packages to be updated.

Would it be be possible to add a ''auto-package-upgrade-count" function using the async package so that it does not freeze the ui ?

Thanks,

jwintz commented 7 years ago

Aslo, I would like to specify an action to spaceline to upgrade all packages that needs so. Is it possible ?

So far, have the following:

(defun prolusion-upgrade-packages ()
  ""
  (interactive)
  (message "Upgrading prolusion packages")
  (package-refresh-contents)
  (save-window-excursion
    (package-list-packages t)
    (package-menu-mark-upgrades)
    (package-menu-execute t)))

Thanks,

rranelli commented 7 years ago

Haven't used the async package yet. From the looks of it, it seems possible to do what you want.

I will try implementing it sometime in the future :)

thanks

jwintz commented 7 years ago

Got this so far, but I really struggle turning it to use aync. I'll let you know ;-) Also, using Emacs 26.0.50.1, I have seen that package-refresh-contents can go asynchronous in some emacs developer mailing list. Will dig into it.

Thanks anyway !

  (spaceline-define-segment prolusion-upgrades-count
    (when (string= major-mode "prolusion/dashboard-mode")
      (unless prolusion-upgrade-count
        (save-window-excursion
          (package-list-packages)
          (package-menu-mode)
          (setq prolusion-upgrade-count (length (package-menu--find-upgrades)))
          (kill-buffer (get-buffer "*Packages*"))))
      (if (> prolusion-upgrade-count 0)
          (format " %s" prolusion-upgrade-count))))