[Top][All Lists]

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

Re: [PATCH] Add notifications.el

From: Julien Danjou
Subject: Re: [PATCH] Add notifications.el
Date: Wed, 09 Jun 2010 21:47:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Wed, Jun 09 2010, Tassilo Horn wrote:

> (defvar th-notify-body-to-id-map (make-hash-table :test 'string=)
>   "Maps BODY values of notifications to the last notification ID.
> If ID is -1, then any further notifications with that body will
> be skipped.")
> (defun th-notify (&rest args)
>   "Create a notification popup.
> For ARGS, see `notifications-notify'.
> If there was a notification with the same BODY before, that one
> will be replaced by the current notification."
>   (require 'notifications)
>   (let* ((body (plist-get args :body))
>          (replace-id (or (gethash body th-notify-body-to-id-map)
>                          (plist-get args :replaces-id))))
>     (unless (eql replace-id -1)
>       (puthash
>        body
>        (apply 'notifications-notify
>               (plist-put (plist-put args :replaces-id replace-id)
>                          :timeout 0))
>        th-notify-body-to-id-map))))

What about adding:

  `(lambda (reason)
      (when (eq reason 'dismissed)
         (puthash ,body -1 th-notify-body-to-id-map)))

in `args' ?

Julien Danjou
// ᐰ <address@hidden>   http://julien.danjou.info

Attachment: pgp0HVYKvAWZA.pgp
Description: PGP signature

reply via email to

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