Subject: Re: Emacs Lisp compiling
From: Erik Naggum <erik@naggum.no>
Date: 1999/05/01
Newsgroups: comp.lang.lisp
Message-ID: <3134568362820546@naggum.no>

* sHiNOBi iRi <shuriken@armory.com>
| I'm assuming that you can run lisp programs by typing them in a terminal,
| for instance, just like an an executable from c++ code..

  yes, but in a somewhat different environment.  the executable for C++
  code is a function that resides on disk and which is loaded into memory
  when you call it.  it then runs to completion and you're back at the
  operating system prompt or whatever.  in Emacs, the loading is separated
  from the calling.  you load the file into Emacs, and then you call the
  function.  however, since the normal action when you type into Emacs is
  to insert the characters into a buffer, you may have to do something
  special to call the function.  one option is to be in the *SCRATCH*
  buffer, which is in LISP-INTERACTION mode.  (the capitalization here is
  not to be taken literally, but as differentiating names from the text.)
  here you can type expressions, but when you type C-j (LF) after a form,
  it gets evaluated.  (this is like pressing return (C-m, CR) in a normal
  command-line interaction.)  another option is to call the function
  EVAL-EXPRESSION through the keybinding M-: and give it the form to
  evaluate.  yet another option is to make the function "interactive",
  which means that it may be bound to a key or called with M-x, and reads
  its own arguments from the user.

  Emacs Lisp is a Lisp environment, like Windows is a C++ environment and
  Unix/Linux is a C environment.  when you wish to mix environments, it is
  very instructive to see their similarities relative to their natural
  habitat, not try to force them to be similar in the natural habitat of
  the other.  e.g., the fact that you start your computer and it loads the
  operating system and finds which functions are available is analogous to
  starting Emacs and loading the files you need to call your functions.
  typically, therefore, you ask Emacs to load all your files for you in
  .emacs, which Emacs loads automatically, and then you call them.

  to compile Emacs Lisp files, use BYTE-COMPILE-FILE.  other Lisps have
  something very similar.   to load the compiled files, use LOAD.

  (for a more Emacs-specific response and a less general Lisp response, you
  might try comp.emacs.)

#:Erik