From: Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc: emacs-devel@gnu.org
Subject: Re: toggle-viper-mode strangeness
Date: Fri, 20 Jan 2006 04:35:21 +0200 [thread overview]
Message-ID: <20060120023521.GA57669@flame.pc> (raw)
In-Reply-To: <E1EzkrW-000090-Hn@fencepost.gnu.org>
On 2006-01-19 20:14, "Richard M. Stallman" <rms@gnu.org> 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 :)
next prev parent reply other threads:[~2006-01-20 2:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 1:13 toggle-viper-mode strangeness Giorgos Keramidas
2006-01-19 21:43 ` Kevin Rodgers
2006-01-20 1:14 ` Richard M. Stallman
2006-01-20 2:35 ` Giorgos Keramidas [this message]
2006-01-20 3:38 ` Johan Bockgård
2006-01-20 4:03 ` Stefan Monnier
2006-01-20 4:14 ` Luc Teirlinck
2006-01-20 12:45 ` Giorgos Keramidas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060120023521.GA57669@flame.pc \
--to=keramida@ceid.upatras.gr \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).