From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: Can this be improved Date: Mon, 15 Sep 2014 10:53:37 +0200 Organization: Decebal Computing Message-ID: <87wq95jmcu.fsf@Equus.decebal.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410771931 12961 80.91.229.3 (15 Sep 2014 09:05:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Sep 2014 09:05:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 15 11:05:26 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XTSDq-0002rO-Ve for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 11:05:23 +0200 Original-Received: from localhost ([::1]:58095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTSDq-0004LB-HT for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 05:05:22 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Injection-Info: mx05.eternal-september.org; posting-host="5552e08b8576d835f873fb9fc32a23c3"; logging-data="12296"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19o1t5eCr9iKICzzLoNMbPFnztZDgbPlEo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Homepage: http://www.decebal.nl/ X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E Cancel-Lock: sha1:2fTNVl9IJOddysSv1zfuCP4PtYQ= sha1:lbhNRMTOD9DUjHkZoY36HWSHxak= Original-Xref: usenet.stanford.edu gnu.emacs.help:207628 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99901 Archived-At: I have a few things I poll during idle time in Gnus. At the moment I have the following structure: dcbl-gnus-poll-struct (list (list :idle 3 :function 'dcbl-gnus-delay-send-queue :last-run 'dcbl-gnus-last-time-delay-send :message "send delayed messages" :wait 5) (list :idle 5 :function 'dcbl-gnus-group-get-new-news :last-run 'dcbl-gnus-last-time-got-news :message "getting new news" :prefer-end 15 :prefer-start 5 :prefer-wait 30 :wait 60) (list :idle 15 :function 'dcbl-gnus-group-expire-all-groups :last-run 'dcbl-gnus-last-time-expired-articles :message "expire" :wait (- (/ +seconds-in-day+ +seconds-in-minute+) 2)) )) At this moment I have three things I do: sending delayed messages, getting new news and expiring articles. Every polling structure needs at least: - idle: minutes idle before function is allowed to run - function: function to run - last-run: last time function was run - message: description used in logging - wait: minimum number of minutes between runs Because I like the messages fetched shortly after the whole hour, I have also: - prefer-end: end minute of preferred period - prefer-start: start minute of preferred period - prefer-wait: minimum number of minutes that the function was not run in preferred period Because with the current data structure it is no use to call the daemon handler after a minute of idleness I set the Gnus idle daemon with: (gnus-demon-add-handler 'dcbl-gnus-idle-daemon 1 (let ((value nil)) (apply 'min (dolist (poll-element dcbl-gnus-poll-struct value) (push (getf poll-element :wait) value))))) Is this the correct way to do this, or is there a better way? By the way gnus-demon-add-handler is correct. Probably a spelling mistake made long ago. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof