[slime-devel] Re: marco's highly opiniated guide to editing lisp code in emacs

Luke Gorrie luke at bluetail.com
Mon Jul 19 13:07:05 UTC 2004


Great idea Marco.

Here are my highly opinionated added comments :-)

Marco Baringer <mb at bese.it> writes:

> 2 - learn to use structured editing. what the hell is structured
> editing? it's just a way of working which attempts, as much as is
> usefull, to keep the source code consistently valid. this means,
> among other things, that you inserting an open parenthesis should
> insert the closing one as well (idem for ").

Yes. A good start is to learn M-(, then C-M-{f,b}, then C-M-{u,d},
C-M-t, etc. Takes a while to learn them all but it's not so bad if you
start using them one at a time.

> 2b - so how do you insert a simple, stand alone, ( or ) char? i
> happen to have the = char directly below ) and the \ char just to the
> left of that, so here's what i use:
>
> (define-key slime-mode-map [(control ?\=)] (lambda () (interactive) (insert "(")))
> (define-key slime-mode-map [(control ?\\)] (lambda () (interactive) (insert ")")))

You could also use `C-q (' to insert a "(".

> 3 - when editing lisp code you generally don't work on a line or
> character basis, but you work by moving around lists. usefull emacs
> functions:

I use the standard bindings for these myself. But yes, it's good to
learn all the sexp-based editing commands, and they're pretty easy to
pick up one at a time, e.g. starting with C-M-{a,b}, then C-M-{d,u},
then C-M-k, etc.


My own highly opinionated additions:

Standard Emacs commands:
Learn to use C-{n,p,f,b,a,e} instead of arrow keys. Use C-m for
return, C-h for backspace (Help is moved to Hyper-h), C-i for tab,
and so on. They are easier to reach.

Keywiz:
Use keywiz.el (http://www.ifa.au.dk/~harder/keywiz.el) to learn new
Emacs commands. Keywiz is a game that shows you the name & docstring
of a command and challenges you to press the corresponding key
sequence. /Highly/ educational.

(Someone should hack keywiz to work on one keymap at a time.)

Keyboard:
Use the Alt key for Meta, not Escape. Turn Capslock into
Control. Convert some key into a Hyper modifier (right-shift for
me). The xkeycaps program takes care of this.

Bindings:
Add lots of convenient bindings on Hyper-<char> and C-c
<unshifted-char>. Examples: pop global mark ring (aka
`(set-mark-command t)'), slime-selector, put other-window on H-o.

Should also bind short Hyper-prefixed window manager keys for
maximize-window-{fully,horizontally,vertically}, close window, focus
window to <left|right|up|down>. Use a grid of enough virtual desktops
that you don't need to have any overlapping windows. This is easy in
Sawfish at least.

-Luke





More information about the slime-devel mailing list