Sunday, August 14, 2022

Question about indentation of if in lisp mode

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.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/YvkYADtsndvqP%2Bz0%40ws.

No comments: