unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: David Kastrup <David.Kastrup@t-online.de>
Subject: Re: multi-line conditionals in elisp
Date: 22 Dec 2002 20:12:42 +0100	[thread overview]
Message-ID: <x5smwphnpx.fsf@lola.goethe.zz> (raw)
In-Reply-To: ulm2hc1zw.fsf@trollope.org

Michael Powe <michael+gnus@trollope.org> writes:

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

That is junk.  I recommend you look up progn.

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

5 years and you don't know progn.  That certainly _is_ impressive.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2002-12-22 19:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-22 19:00 multi-line conditionals in elisp Michael Powe
2002-12-22 19:12 ` David Kastrup [this message]
2002-12-22 22:48   ` Michael Powe
2002-12-22 23:05     ` David Kastrup
2002-12-24  3:17       ` Jesper Harder
     [not found] ` <michael+gnus@trollope.org>
2002-12-22 19:21   ` Peter S Galbraith
     [not found] ` <mailman.524.1040584903.19936.help-gnu-emacs@gnu.org>
2002-12-22 22:40   ` Michael Powe

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=x5smwphnpx.fsf@lola.goethe.zz \
    --to=david.kastrup@t-online.de \
    /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).