From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.devel Subject: Re: toggle-viper-mode strangeness Date: Fri, 20 Jan 2006 04:35:21 +0200 Message-ID: <20060120023521.GA57669@flame.pc> References: <20060119011332.GA75423@flame.pc> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137724552 11375 80.91.229.2 (20 Jan 2006 02:35:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 02:35:52 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 20 03:35:49 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ezm7w-0001yn-06 for ged-emacs-devel@m.gmane.org; Fri, 20 Jan 2006 03:35:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EzmAO-0002Hw-Kd for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2006 21:38:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EzmAE-0002Hq-Th for emacs-devel@gnu.org; Thu, 19 Jan 2006 21:38:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EzmA9-0002HZ-Uw for emacs-devel@gnu.org; Thu, 19 Jan 2006 21:38:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EzmA9-0002HW-SW for emacs-devel@gnu.org; Thu, 19 Jan 2006 21:38:05 -0500 Original-Received: from [80.76.39.13] (helo=mail.vivodinet.gr) by monty-python.gnu.org with smtp (Exim 4.34) id 1EzmEH-0007aY-SR for emacs-devel@gnu.org; Thu, 19 Jan 2006 21:42:22 -0500 Original-Received: (qmail 22551 invoked from network); 20 Jan 2006 02:35:29 -0000 Original-Received: from dslcustomer-222-89.vivodi.gr (HELO flame.pc) (83.171.222.89) by 0 with SMTP; 20 Jan 2006 02:35:29 -0000 Original-Received: by flame.pc (Postfix, from userid 1001) id C02C1118D8; Fri, 20 Jan 2006 04:35:21 +0200 (EET) Original-To: "Richard M. Stallman" Content-Disposition: inline In-Reply-To: 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:49293 Archived-At: On 2006-01-19 20:14, "Richard M. Stallman" wrote: > Here's what that code does: > > (if (eq viper-mode t) > ;; Turn the mode off. > (viper-go-away) > ;; Turn the mode on. > (setq viper-mode nil) > (viper-mode))) > > It looks correct to me, except perhaps for the eq call, > which treats non-nil non-t values as "off" rather than "on". > That is peculiar, but I don't know whether it is wrong. I was under the impression that an (if cond then else) expression can only have 4 parts within the parentheses. This means that the above would require a (progn) around the final two parts, i.e.: (if (eq viper-mode t) ;; Turn the mode off. (viper-go-away) ;; Turn the mode on. (progn (setq viper-mode nil) (viper-mode))) It looks like I was wrong, and the else part can contain more than one s-exp, returning the value of the last one. Thanks :)