From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "metaperl.com" Newsgroups: gmane.emacs.help Subject: Calling a function every random number of minutes, where random amount changes Date: Thu, 29 Nov 2007 07:51:16 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196354446 7863 80.91.229.12 (29 Nov 2007 16:40:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2007 16:40:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 29 17:40:53 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IxmRX-0005NU-GY for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Nov 2007 17:40:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IxmRH-000145-Nw for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Nov 2007 11:40:35 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!y43g2000hsy.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: 159.53.46.143 Original-X-Trace: posting.google.com 1196351477 31127 127.0.0.1 (29 Nov 2007 15:51:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 29 Nov 2007 15:51:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y43g2000hsy.googlegroups.com; posting-host=159.53.46.143; posting-account=GDJYuQoAAACvR3VU3OOyv8hdViWomHUu User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; TheWorld),gzip(gfe),gzip(gfe) Content-Disposition: inline Original-Xref: shelby.stanford.edu gnu.emacs.help:154260 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49688 Archived-At: The code below randomly selects one of my favorite color-themes. I would like to set something up so that (color-theme-random) is called after n minutes have elapsed. Where n is non-constant and randomly chosen between 5 and 60. In other words, after 7 minutes it calll the function. Then after 30 minutes it calls it again. Then 12 minutes... and so on and so on. (require 'color-theme) (random t) (defvar *color-theme-favorites* '( arjen andreas billw blippblopp blue-mood blue-sea calm-forest classic comidia dark-blue dark-blue2 deep-blue euphoria feng-shui fischmeister goldenrod gray1 gray30 high-contrast hober infodoc jb-simple jonadabian jsc-dark jsc-light kingsajz late-night lawrence lethe marine marquardt midnight mistyday montz oswald parus robin-hood simple-1 subtle-blue tty-dark word-perfect xp )) (defun color-theme-random() (interactive) (let* ((choice (nth (random (length *color-theme-favorites*)) *color-theme-favorites*)) (fn (intern (format "color-theme-%s" choice)))) (funcall fn))) (color-theme-random) (provide 'color-theme-random) ;;;