unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* conditionals in elisp
@ 2009-10-27  0:08 Harry Putnam
  2009-10-27  0:25 ` Richard Riley
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Harry Putnam @ 2009-10-27  0:08 UTC (permalink / raw)
  To: help-gnu-emacs

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.





^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2009-11-02 19:31 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.9533.1256602126.2239.help-gnu-emacs@gnu.org>
2009-10-27  0:19 ` conditionals in elisp 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
2009-10-27  0:08 Harry Putnam
2009-10-27  0:25 ` 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

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).