From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.help Subject: conditionals in elisp Date: Mon, 26 Oct 2009 19:08:13 -0500 Organization: Still searching... Message-ID: <87iqe1og0i.fsf@newsguy.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256602157 5382 80.91.229.12 (27 Oct 2009 00:09:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Oct 2009 00:09:17 +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 Oct 27 01:09:10 2009 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 1N2Zcb-00036C-Gi for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Oct 2009 01:09:09 +0100 Original-Received: from localhost ([127.0.0.1]:41999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N2Zca-0007DA-Tb for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Oct 2009 20:09:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N2ZcB-0007Cx-PC for help-gnu-emacs@gnu.org; Mon, 26 Oct 2009 20:08:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N2Zc7-0007CU-HK for help-gnu-emacs@gnu.org; Mon, 26 Oct 2009 20:08:43 -0400 Original-Received: from [199.232.76.173] (port=51886 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N2Zc7-0007CR-DL for help-gnu-emacs@gnu.org; Mon, 26 Oct 2009 20:08:39 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:58117) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N2Zc7-0000CY-1j for help-gnu-emacs@gnu.org; Mon, 26 Oct 2009 20:08:39 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1N2Zc4-0002yM-8k for help-gnu-emacs@gnu.org; Tue, 27 Oct 2009 01:08:36 +0100 Original-Received: from c-98-215-178-110.hsd1.in.comcast.net ([98.215.178.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Oct 2009 01:08:36 +0100 Original-Received: from reader by c-98-215-178-110.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Oct 2009 01:08:36 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 62 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-98-215-178-110.hsd1.in.comcast.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:v69UYAzm6NwteRejQiVGeKGCkWo= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:69259 Archived-At: I'm hoping someone will be kind enough to demonstrate a couple of brief conditionals in elisp... if and if else. This may be a chintzy way to do it but I really do not want to pound away at elisp intro and the elisp manual for hours. I usually start seeing red at the 4-5 paragraph and usually have been able to learn what I needed to know in things like perl and shell scripting from just a few real live examples that do something at least close to what I am trying then I can edit and tinker until I start to sort of `get it'. In this case, I thought I'd like to start 2 instances of emacs and in each instance start the server on different names. 1 to do nothing but run gnus from several remotes and the localhost.. and 2, for a programming/editing instance also to connect from several remotes and local. That is, not try to do both in the emacs running gnus. I know how to start daemons with different names... from cmdline or on X start up or whatever, ... but here I want to start them from a running instances of emacs. Anyway cutting to the chase... tried writing an *.el file to load when I'm ready, that would be something like: cat .srvr.el (load-library "server") (setq server-name "gnus") (server-mode) Then from each emacs instance do: Eval: (load-file "/home/reader/.srvr.el") I learned that things need to happen in that order (from a running emacs) from devs on the devel list. However since `server-mode' is a toggle... I thought I probably should test for whether it is already enabled, so I don't end up turning it off. Maybe test to see if `server.el' is already loaded too... if that makes sense to do. That's when I bumped into my ignorance, realizing I had no idea how to write simple conditionals that would do this: (over verbosified for clarity) (The variable in the if clause is imaginary) (load-library "server") (setq server-name "name") if (! server-mode-enabled){ (server-mode) } Probably at risk of showing the horrible bleak depths of my ignorance... but I hope you get the idea... and hope further that it even makes any sense at all... Even if doing it the way I mention above makes no sense.. I would like to know the better way of course, but would still like to see a couple of simple elisp conditionals that do something simple.