help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

conditionals in elisp


From: Harry Putnam
Subject: conditionals in elisp
Date: Mon, 26 Oct 2009 19:08:13 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]