[slime-devel] Re: Questions about latest slime (where did feature X go?)

Helmut Eller heller at common-lisp.net
Wed Sep 5 13:53:46 UTC 2007


* Jonathon McKitrick [2007-09-05 15:17+0200] writes:

> I'm new to elisp programming, but not to lisp itself.
> I currently have <f5> bound to 'slime, and that works well.  Would it make
> more sense to write my own elisp function that is bound to <f5> and
> in that function call (require 'slime) and (slime-setup) instead of
> calling it every time emacs starts?

The only problem I see with that approach, is that you may also need
some other commands, say slime-connect, and that would probably lead
to some duplication.

I'd load slime-autoloads, bind <f5> to 'slime, and call slime-setup in
.emacs.  Slime local key bindings for can be defined in
slime-mode-hook or slime-load-hook.

In ELisp you can use `autoload' to declare a function as autoloaded.
E.g. (autoload 'slime "slime" nil t) will automatically load
"slime.el[c]" when the function slime is called the first time.
[Loading the file will then install the proper function, and if the
file doesn't have a definition for it, Emacs complains with a somewhat
meaningful error message.]

The usual way to save startup time is to declare all needed functions
as autoloaded and to do customizations in hooks.  The file
slime-autoloads does just that.

slime-setup just sets some variables; it's cheap to execute.
slime-setup is also intended for newbies, so that they only need one
or two lines in their .emacs.  More experienced users will probably
add the necessary hooks "manually".

Helmut.




More information about the slime-devel mailing list