From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add notifications.el Date: Wed, 09 Jun 2010 21:47:47 +0200 Message-ID: <87ljaoyom4.fsf@keller.adm.naquadah.org> References: <1275757657-15244-1-git-send-email-julien@danjou.info> <201006092018.10163.tassilo@member.fsf.org> <87ocfkkpgg.fsf@keller.adm.naquadah.org> <201006092116.46374.tassilo@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: dough.gmane.org 1276112903 18986 80.91.229.12 (9 Jun 2010 19:48:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Jun 2010 19:48:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 09 21:48:20 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OMRG2-0002ji-B8 for ged-emacs-devel@m.gmane.org; Wed, 09 Jun 2010 21:48:14 +0200 Original-Received: from localhost ([127.0.0.1]:33612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMRG1-0001Aj-Rl for ged-emacs-devel@m.gmane.org; Wed, 09 Jun 2010 15:48:13 -0400 Original-Received: from [140.186.70.92] (port=50032 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMRFm-0000xc-3T for emacs-devel@gnu.org; Wed, 09 Jun 2010 15:47:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMRFk-0007qh-SO for emacs-devel@gnu.org; Wed, 09 Jun 2010 15:47:57 -0400 Original-Received: from prometheus.naquadah.org ([212.85.154.174]:56061 helo=mx1.naquadah.org) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMRFk-0007qX-Lg for emacs-devel@gnu.org; Wed, 09 Jun 2010 15:47:56 -0400 Original-Received: by mx1.naquadah.org (Postfix, from userid 8) id A440A5C127; Wed, 9 Jun 2010 21:47:54 +0200 (CEST) Original-Received: from keller.adm.naquadah.org (chapai.naquadah.org [82.227.158.144]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id 9A56B5C11B; Wed, 9 Jun 2010 21:47:52 +0200 (CEST) Original-Received: from jd by keller.adm.naquadah.org with local (Exim 4.72) (envelope-from ) id 1OMRFb-0003tZ-7Z; Wed, 09 Jun 2010 21:47:47 +0200 In-Reply-To: <201006092116.46374.tassilo@member.fsf.org> (Tassilo Horn's message of "Wed, 9 Jun 2010 21:16:45 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125683 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 09 2010, Tassilo Horn wrote: > (defvar th-notify-body-to-id-map (make-hash-table :test 'string=3D) > "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: :on-close `(lambda (reason) (when (eq reason 'dismissed) (puthash ,body -1 th-notify-body-to-id-map))) in `args' ? =2D-=20 Julien Danjou // =E1=90=B0 http://julien.danjou.info --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkwP7+MACgkQpGK1HsL+5c1GNQCfWc3y1eLR+dljsVxIv73hG8Hc R2MAnRcofgPDiHdaa7yODOPVJlZdbEZT =3nV5 -----END PGP SIGNATURE----- --=-=-=--