[slime-devel] smarter loop indentation?

Mac Chan emailmac at gmail.com
Fri Apr 20 06:55:19 UTC 2007


On 4/19/07, Nikodemus Siivola <nikodemus at random-state.net> wrote:
> > I'd _really_ like to keep my code in 80-column if I can help it.
>
> I seriously doubt if messing with loop indentation is a good
> way to accomplish that

Agreed, but a lot of macro forms are indented nicely except for
`loop'.

(dotimes ()
  ...)

(dolist ()
  ...)

look a lot nicer than

(loop ...
      ...
      ...)

Maybe it's just me.


> (setq lisp-simple-loop-indentation 2
>        lisp-loop-keyword-indentation 6
>        lisp-loop-forms-indentation 6)
>
> Is what I keep in .emacs.
>
> Setting them all to 2 might be to your taste.

Thanks for the tip. But it doesn't seem to work.

Here's my .emacs

(setq lisp-simple-loop-indentation 2
      lisp-loop-keyword-indentation 2
      lisp-loop-forms-indentation 2)

(setq inferior-lisp-program "/usr/bin/sbcl")

(require 'slime)

I started emacs and then M-x slime to launch sbcl

M-x slime-scratch and then type in the following

_(loop for i from 1 upto 3
for x in '(a b c) collect
(cons i x))

With the cursor at _ I pressed C-M-q indent-sexp and the result is

(loop for i from 1 upto 3
      for x in '(a b c) collect
      (cons i x))
	
Same result if I mark the region and then press C-M-\ indent-sexp
	
I tried `Describe variable' on lisp-simple-loop-indentation,
lisp-loop-keyword-indentation and lisp-loop-forms-indentation but
there's no documentation for these.

Are these slime specific or emacs only?

BTW I'm using emacs 21.4, CVS slime and sbcl 0.9.14 on fedora4

Thanks,
-- Mac



More information about the slime-devel mailing list