From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Powe Newsgroups: gmane.emacs.help Subject: multi-line conditionals in elisp Date: Sun, 22 Dec 2002 19:00:43 GMT Organization: The Hospice of the Mind Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1040584088 8206 80.91.224.249 (22 Dec 2002 19:08:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 22 Dec 2002 19:08:08 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18QBRg-00026I-00 for ; Sun, 22 Dec 2002 20:07:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18QBPy-0005n7-09 for gnu-help-gnu-emacs@m.gmane.org; Sun, 22 Dec 2002 14:05:42 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsread.com!newsstand.netaxs.com!POSTED.monger.newsread.com!not-for-mail Original-Newsgroups: gnu.emacs.help X-Newsreader: Gnus v5.8.8/Emacs 20.7.2 [Linux 2.2.16] X-Home-Page: http://www.trollope.org Original-Lines: 56 Cache-Post-Path: gaspra.spiretech.com!unknown@slip-32-100-238-101.ca.us.prserv.net X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) Original-NNTP-Posting-Host: 207.173.200.229 Original-X-Complaints-To: Abuse Role , We Care Original-X-Trace: monger.newsread.com 1040583643 207.173.200.229 (Sun, 22 Dec 2002 14:00:43 EST) Original-NNTP-Posting-Date: Sun, 22 Dec 2002 14:00:43 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:108419 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4948 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4948 hello, sorry for the dumb question, but i'm sure of the best way to do this. i have emacs installed on several machines and would like to use a single .emacs. it's annoying to have to maintain different ones, and i forget sometimes that one library is installed on one machine but not on another. my solution was to put a conditional in the .emacs to test for the existence of a library before following its loading instructions. what i'm having a problem with, is conditionals of this format: if (true) do item one do item two do item three ... else do item four this is trivial in other languages, but not, it seems, in elisp. (i think it's just a case of, i don't really understand the language.) here's what i did: (if (locate-library "python-mode") (cond((autoload 'python-mode "python-mode" "Python editing mode" t) (setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)))) (message "python library not found")) this seems to work. (just putting an extra pair of parens around the multiple statements did not work. i guess that would be the equivalent of {} in C.) but i'm not sure if it's the best or only way. after all, if i have more than two items in the first part of the conditional, that means stringing along multiple conds. an example would be mailcrypt, which in one of my .emacs has 7 line items, setting and loading variables. i dunno, it seems clumsy to me because i'd be invoking the cond not because i'm interested in its outcome per se, but just to force execution of the next statement. thanks for any help. mp nb. trivial note: on my main workstation, i maintain my dot-files in rcs. i noted yesterday that my oldest entry in the .emacs is from january 30, 1998. so, in a little over a month, it will be 5 years old. that's a lot of bits & bytes through the pipe. and emacs is still God's Own Editor(tm). ;-) Happy Holidays! -- Michael Powe Waterbury, CT ------------------------------------------------------------- "The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in. We're computer professionals. We cause accidents." -- Nathaniel Borenstein