[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add notifications.el
From: |
Tassilo Horn |
Subject: |
Re: [PATCH] Add notifications.el |
Date: |
Wed, 9 Jun 2010 21:16:45 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.34-gentoo; KDE/4.4.4; x86_64; ; ) |
Hi!
> > How do I get the id of the closed notification? Wouldn't it be
> > better to pass the id to that function, too?
>
> It'd be possible sure, but I did not think it was worth it nor it
> would have a use case. You can passe a lambda/closure to :on-close,
> can't you?
Not really, cause the ID I need is the return value of the
`notifications-notify', so I cannot use it as parameter to that
function. And elisp doesn't have closures anyway.
> If you have an problematic example maybe we can figure out.
Here's my code:
--8<---------------cut here---------------start------------->8---
(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))))
--8<---------------cut here---------------end--------------->8---
So what I want, is that if I delete a notification, there should be a
mapping from :body value to -1 in th-notify-body-to-id-map, so that no
new notifications are performed for that entry.
Bye,
Tassilo
- Re: [PATCH] Add notifications.el, (continued)
- Re: [PATCH] Add notifications.el, Jan Moringen, 2010/06/10
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/11
- Message not available
- Re: [PATCH] Add notifications.el, Jan Moringen, 2010/06/11
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/11
- Re: [PATCH] Add notifications.el, Michael Albinus, 2010/06/11
- Re: [PATCH] Add notifications.el, Jan Moringen, 2010/06/11
- Re: [PATCH] Add notifications.el, Stefan Monnier, 2010/06/08
- Re: [PATCH] Add notifications.el, Michael Albinus, 2010/06/09
Re: [PATCH] Add notifications.el, Tassilo Horn, 2010/06/09
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/09
- Re: [PATCH] Add notifications.el,
Tassilo Horn <=
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/09
- Re: [PATCH] Add notifications.el, Tassilo Horn, 2010/06/09
- Re: [PATCH] Add notifications.el, Stefan Monnier, 2010/06/09
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/09
- Re: [PATCH] Add notifications.el, Stefan Monnier, 2010/06/09
- Re: [PATCH] Add notifications.el, Tassilo Horn, 2010/06/10
- Re: [PATCH] Add notifications.el, Julien Danjou, 2010/06/10
- Re: [PATCH] Add notifications.el, Michael Albinus, 2010/06/10
- [PATCH] Passes notification id as argument of on-action and on-close functions, Julien Danjou, 2010/06/10
- Re: [PATCH] Passes notification id as argument of on-action and on-close functions, Michael Albinus, 2010/06/10