Question about indentation of if in lisp mode

7 views
Skip to first unread message

Wolf

unread,
Aug 15, 2022, 8:30:42 AM8/15/22
to v...@vim.org
Hello,

I've recently started learning lisp and noticed that vim (when in lisp
mode) tries to indent if in this way:

(if <predicate>
<consequent>
<alternative>)

However, my impression from the learning resources I have at hand (SICP
book, guile source code and glimpse at how emacs does it) is that the
"common" way is:

(if <predicate>
<consequent>
<alternative>)

In the end I've managed to figure out that putting this line into .vimrc
gets me the behavior I want:

set lw-=if

Now, I would like to ask a couple of questions and I hope someone will
be kind enough to answer :)

1. Is it fine to do `lw -= if'? Does it affect anything except the
indentation? From the documentation it seems to be safe, but I want
to make sure.
2. Why is the default indentation like this? From where does it
originate, what lisp variant prefers it?
3. The 'lw' contains `case' as well, however for it the indentation is as
one would expect, why?
4. Would it be possible (and desired) to change the default behaviour,
at least when not in vi-compatible mode?

Thank you for your time and have a nice day,
W.

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
signature.asc
Reply all
Reply to author
Forward
0 new messages