From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: If clause depending on name of the day Date: Tue, 3 Apr 2012 13:05:00 -0700 Message-ID: References: <87d37ovd60.fsf@gmx.ch> <87limc6289.fsf@kvarnholmen.matholka.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1333483534 26331 80.91.229.3 (3 Apr 2012 20:05:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 3 Apr 2012 20:05:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 03 22:05:33 2012 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 1SF9yt-0000nR-PO for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Apr 2012 22:05:31 +0200 Original-Received: from localhost ([::1]:45049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF9yk-0006Hn-4h for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Apr 2012 16:05:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF9yb-0006GZ-K7 for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 16:05:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SF9yT-0001CO-L1 for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 16:05:13 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:38332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SF9yT-00014K-AV for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 16:05:05 -0400 Original-Received: by werj55 with SMTP id j55so77461wer.0 for ; Tue, 03 Apr 2012 13:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=fKcxJ1y6Qytd5cq45w2ttkeX0stYpmJ9ppIiWHpPitc=; b=RX6n+mmyr4H5KqQxQl/6lIuGeK2G29lCp3BsgPx0vXug1xaeMVAyu3R+1KjKgoWAB3 jcZVkfIunaasSQkoRXYEXufm3WWIrFo6ywiGI/0K9B3m/6gJOpX5DQuHmvWwyE5C/cG1 0ggm/2cwOd+xkzEbmJrYUwGyJXYSecujVllUjYZmGddN41LRaN5bc7CPkdAbopdIHGeI rOw0a7mwy5GvHivpz+bblk77Pga9iq3f53dTThoEsF5jeggShVSjB6zND0b8NoI4KS5D Ji06nZDAFRwM9FJbj49ppxSu3GVPnxT00dZ9vNe1VsD6qO8hjxJBhW2acmsotf6wF0K/ /fYw== Original-Received: by 10.180.104.230 with SMTP id gh6mr39238243wib.22.1333483500718; Tue, 03 Apr 2012 13:05:00 -0700 (PDT) Original-Received: by 10.223.116.200 with HTTP; Tue, 3 Apr 2012 13:05:00 -0700 (PDT) In-Reply-To: <87limc6289.fsf@kvarnholmen.matholka.se> X-Google-Sender-Auth: 7aMyTws2cPq_qCgO_Junn9DpNpU X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 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:84301 Archived-At: On Tue, Apr 3, 2012 at 12:32 PM, Lars Ljung wrote: > "Sven Bretfeld" writes: >> Is it possible to have an if-condition that looks for the current day? >> So that the then-expression does something different on Tuesday than on >> Friday? > > (nth 6 (decode-time)) returns 0-6 for Sunday-Saturday. So you could do something like this: (require 'cl) (case (nth 6 (decode-time)) (0 (message "Today is Sunday")) ((1 3 5) (message "Today is Monday, Wednesday, or Friday")) (2 (message "Today is Tuesday")) (t (message "It's some other day."))) -PJ Gehm's Corollary to Clark's Law: Any technology distinguishable from magic is insufficiently advanced.