From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79152 Path: news.gmane.org!not-for-mail From: Philipp Haselwarter Newsgroups: gmane.emacs.gnus.general Subject: Re: scanning for new mail with demon-handler Date: Mon, 20 Jun 2011 04:19:41 +0200 Message-ID: <877h8hz1ky.fsf@nzebook.haselwarter.org> References: <874o3o760s.fsf@yun.yagibdah.de> <87d3icxuce.fsf@topper.koldfront.dk> <87r56ss2hp.fsf@yun.yagibdah.de> <877h8k9sg9.fsf@topper.koldfront.dk> <87aadgkxi3.fsf@yun.yagibdah.de> <87oc1tlqa1.fsf@nzebook.haselwarter.org> <87mxhdwk3m.fsf@topper.koldfront.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="broadside/North-Korea/AFSPC/blackjack/HAMASMOIS/Px5z5+YU03" X-Trace: dough.gmane.org 1308536453 21167 80.91.229.12 (20 Jun 2011 02:20:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2011 02:20:53 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M27451@lists.math.uh.edu Mon Jun 20 04:20:48 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QYU6Z-0006aj-Lz for ding-account@gmane.org; Mon, 20 Jun 2011 04:20:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1QYU5v-0001LW-GM; Sun, 19 Jun 2011 21:20:07 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1QYU5t-0001LL-Ou for ding@lists.math.uh.edu; Sun, 19 Jun 2011 21:20:05 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1QYU5r-000416-91 for ding@lists.math.uh.edu; Sun, 19 Jun 2011 21:20:05 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QYU5o-0000XP-AD for ding@gnus.org; Mon, 20 Jun 2011 04:20:00 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QYU5o-0006MR-4B for ding@gnus.org; Mon, 20 Jun 2011 04:20:00 +0200 Original-Received: from 55.93.114.78.rev.sfr.net ([78.114.93.55]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Jun 2011 04:20:00 +0200 Original-Received: from philipp.haselwarter by 55.93.114.78.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Jun 2011 04:20:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 75 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 55.93.114.78.rev.sfr.net X-NSA-Fodder: Kennedy encryption Abbas Capricorn analyzer Area 51 Israel X-Meat: Prosciutto User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:m8be7Tz5zAg7ExftH/gFxUQcDRM= X-Spam-Score: -4.9 (----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79152 Archived-At: --broadside/North-Korea/AFSPC/blackjack/HAMASMOIS/Px5z5+YU03 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2011-06-19 22:07 UT, Adam Sjøgren wrote: AS> On Sun, 19 Jun 2011 18:49:58 +0200, Philipp wrote: >> +(fset 'gnus-demon-scan-news-1 + (apply-partially >> 'gnus-demon-scan-news 1)) +(fset 'gnus-demon-scan-news-2 + >> (apply-partially 'gnus-demon-scan-news 2)) AS> [...snipped the last 7...] AS> That looks like...there must be a better way than such repetition? >> (gnus-demon-add-handler 'gnus-demon-scan-news-1 121 10) AS> Maybe you could do something like a lambda here instead?Along the AS> lines of AS> (gnus-demon-add-handler '(lambda () (gnus-demon-scan-news 1)) 121 AS> 10) AS> or something? Using lambda-forms on timers has the same problem as their usage on hooks, they're a pain to deal with once you added them. Simple overriding or removing them fails. Evaluating gnus-demon-add-handler several times results in a new timer getting added every time. #+begin_src emacs-lisp (gnus-demon-add-handler (lambda () (message "foo")) 8 3) ;; comparison with `eq' fails with current code: (gnus-demon-remove-handler (lambda () (message "foo"))) #+end_src Then again, this could be easily fixed, which would certainly make sense, no matter if the fsets are provided or not: --broadside/North-Korea/AFSPC/blackjack/HAMASMOIS/Px5z5+YU03 Content-Type: text/x-patch Content-Disposition: inline; filename=gnus.patch Content-Description: allow lambda-forms as gnus-demon-handler Modified lisp/gnus-demon.el diff --git a/lisp/gnus-demon.el b/lisp/gnus-demon.el index 419346b..c799a3c 100644 --- a/lisp/gnus-demon.el +++ b/lisp/gnus-demon.el @@ -87,7 +87,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's." (defun gnus-demon-remove-handler (function &optional no-init) "Remove the handler FUNCTION from the list of handlers." - (gnus-alist-pull function gnus-demon-handlers) + (gnus-alist-pull function gnus-demon-handlers 'use-assoc) (unless no-init (gnus-demon-init))) --broadside/North-Korea/AFSPC/blackjack/HAMASMOIS/Px5z5+YU03 Content-Type: text/plain AS> Best regards, AS> Adam - not an expert. best, -- Philipp Haselwarter --broadside/North-Korea/AFSPC/blackjack/HAMASMOIS/Px5z5+YU03--