.emacs
file, it is where you perform all
your user-specific custimizations.
Feel free to take a look at
~vandurme/.emacs*
, it is a jumble of files that overlap
and may very well confuse. ~vandurme/.emacs
is of course
the file that I actually use, which itself loads some files
in: ~vandurme/.emacs.d/
.
SLIME is the super duper Lisp editing mode that makes a lot of things much easier and more pleasant.
If you are an emacs novice that just wants slime to work then add the following line to the top of your ~/.emacs
file:
(load "/usr/grads/share/emacs/site-lisp/slime/dot-emacs")
Alternatively, I have been lately poking at a "starter"/example file for use within the department. It has the same few lines as the slime dot-emacs file, as well as other tidbits. Note that as it says in the file, this is not strictly intended to be loaded as-is; I expect most people will want to cut and paste select portions. Lots of comments included:
(load "/usr/grads/share/emacs/site-lisp/dot-emacs")
The first lisp file you load you may need to perform M-x slime
, which means holding down either Alt or Escape, then hitting the letter 'x'.
A prompt will appear at the bottom of the editor (in the minibuffer) where you type "slime" and hit enter.
Once slime is running, I suggest hitting C-x 3
, which
will split the current frame in half horizontally (C-x 2
does so vertically). Most people like making emacs somewhat
fullscreen, editing on one side and iteratively testing/debugging on the
other.
Perhaps one of the most useful SLIME commands
is slime-eval-defun
,
which is bound to C-M-x
. Rather than reloading your lisp
file everytime you make a single change, far more efficient is to get
in the habit of using this handy command.
%
to represent a shell prompt.
Load emacs. The -q
tells emacs to not load any
custimization files, such as ~/.emacs
. We do this here
just to make sure nothing gets in your way of loading slime for this
practice session. I would not expect you to ever use -q
as part of normal emacs use. The flag -l
tells emacs to
load the following file.
% emacs -q -l /usr/grads/share/emacs/site-lisp/dot-emacs
Load slime in emacs, split frame.
Load an example lisp file in emacs. Look through the contents and see
if you can figure out what is going on.
Making sure your cursor is within the function block,
run
From the lisp prompt and without finishing with hitting enter,
type:
If you hit the space key after the function name, you should see in
the mini-buffer an argument signature, this is a nice benefit of using
slime. If you were to just type
Now try running the function:
Now try looking up documentation on the function:
Various shortcuts exist.
M-x slime
C-x 3
C-x C-f /u/vandurme/every-other-line.lisp
slime-eval-defun
.
(every-other-line
(every-ot
and then tab, it
should auto-complete.
(every-other-line "/u/vandurme/every-other-line.lisp")
(documentation 'function 'every-other-line)
Examples of useful SLIME commands
slime-hyperspec-lookup
loads documentation for symbols defined in the Common Lisp Hyperspec (which should include just about all functions and variables you should ever be using for homework assignments). I use this command a lot.slime-inspect
: from a lisp prompt, enter (setf foo (make-hash-table))
, then try inspecting foo
.slime-interrupt
C-c C-c
, this stops whatever is currently running and should place you in the debugging view.