help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package management - auto check for updates?


From: Tassilo Horn
Subject: Re: package management - auto check for updates?
Date: Tue, 25 Mar 2014 16:56:40 +0100
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux)

Neal Becker <ndbecker2@gmail.com> writes:

> package management is finally getting pretty nice in emacs.
>
> I use:
> (package-initialize)
> (require 'felineherd)
>
> Now, every now and then, I manually check for updates.
>
> But it'd be nice if emacs could automatically inform me of updates to
> my installed pacakges.

This works, although it's possibly not the cleanest solution.  It
messages the upgradeable packages and also notifies you via desktop
notifications.

--8<---------------cut here---------------start------------->8---
(defun th/package-check-upgrades ()
  (interactive)
  (cl-flet ((check ()
                   (package-menu-mark-upgrades)
                   (let ((pkgs (mapcar #'car (package-menu--find-upgrades))))
                     (when pkgs
                       (message "PACKAGE UPGRADES: %s" pkgs)
                       (require 'notifications)
                       (notifications-notify :title "Emacs Package Upgrades"
                                             :body (format "%s" pkgs))))))
    (if (get-buffer "*Packages*")
        (with-current-buffer (get-buffer "*Packages*")
          (package-menu-refresh)
          (funcall #'check))
      (save-window-excursion (list-packages))
      (with-current-buffer (get-buffer "*Packages*")
        (funcall #'check)))))
--8<---------------cut here---------------end--------------->8---

If you want, you could run that from an idle timer.

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]