0

When I am using (setq lisp-indent-function 'common-lisp-indent-function), the ifs are indented like this:

(if x
    y
    z)

For Scheme, (setq lisp-indent-function 'scheme-indent-function) also produces the same indentation as above.

I would prefer ifs to be indented like this instead:

(if x
  y
  z)

Is there a way to customize common-lisp-indent-function and scheme-indent-function such that ifs will be indented by two spaces instead of being aligned with the predicate?

1

Yes, there is. There are a few customization suggestions for common-lisp-indent-function inside cl-indent.el. The same mechanism is used for scheme-indent-function. Place the following in your init file:

(put 'if 'scheme-indent-function 1)

To achieve the following indentation in a Scheme buffer:

(if foo
  bar
  baz)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.