unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Harry Putnam <reader@newsguy.com>
To: help-gnu-emacs@gnu.org
Subject: conditionals in elisp
Date: Mon, 26 Oct 2009 19:08:13 -0500	[thread overview]
Message-ID: <87iqe1og0i.fsf@newsguy.com> (raw)

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.





             reply	other threads:[~2009-10-27  0:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27  0:08 Harry Putnam [this message]
2009-10-27  0:25 ` conditionals in elisp Richard Riley
2009-10-27  1:03 ` Drew Adams
2009-10-27  5:33   ` Harry Putnam
2009-10-27  7:37     ` Drew Adams
2009-10-28  9:10       ` Thien-Thi Nguyen
2009-10-28 14:03         ` Drew Adams
     [not found]         ` <mailman.9621.1256738653.2239.help-gnu-emacs@gnu.org>
2009-10-28 15:42           ` LanX
2009-10-28 20:42             ` Harry Putnam
2009-10-28 16:19         ` Harry Putnam
     [not found]         ` <mailman.9630.1256746811.2239.help-gnu-emacs@gnu.org>
2009-11-02 19:31           ` Joseph Brenner
2009-10-27  5:50 ` tomas
     [not found] <mailman.9533.1256602126.2239.help-gnu-emacs@gnu.org>
2009-10-27  0:19 ` Pascal J. Bourguignon
2009-10-27  2:52 ` LanX
2009-10-27 10:36   ` Pascal J. Bourguignon
2009-10-27 12:09     ` Richard Riley
2009-10-27 17:03       ` Sean Sieger
2009-10-28 12:07         ` Richard Riley
     [not found]     ` <mailman.9555.1256645401.2239.help-gnu-emacs@gnu.org>
2009-10-27 12:31       ` Pascal J. Bourguignon
2009-10-27 13:02         ` Richard Riley
     [not found]         ` <mailman.9557.1256648714.2239.help-gnu-emacs@gnu.org>
2009-10-27 16:04           ` Pascal J. Bourguignon
2009-10-27 17:26         ` Harry Putnam
     [not found]         ` <mailman.9572.1256664440.2239.help-gnu-emacs@gnu.org>
2009-10-27 18:37           ` Pascal J. Bourguignon
2009-10-27 19:40             ` Harry Putnam
     [not found]             ` <mailman.9577.1256672457.2239.help-gnu-emacs@gnu.org>
2009-10-27 21:14               ` Pascal J. Bourguignon
2009-10-28 14:05                 ` David Kastrup
2009-10-28 15:55                   ` Harry Putnam
2009-10-28 17:45                   ` Pascal J. Bourguignon

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=87iqe1og0i.fsf@newsguy.com \
    --to=reader@newsguy.com \
    --cc=help-gnu-emacs@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.
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).