kakapo-ret-and-indent: error-checking and better behavior

Apart from error-checking, we also do not introduce any trailing
whitespace when we call this function consecutively (which may happen if
the user presses ENTER two or more times in a row).
kakapo-ret-and-indent: delete trailing (and leading) whitespace

E.g., if we have the line

                foo      -!-       bar

and '-!-' is point, and we press ENTER, we should get

                foo
                -!-bar

instead of

                foo
                -!-       bar

.
kakapo-ret-and-indent: predict desired indent on empty lines

If we just press RET on an empty line, do not simply add a "\n" newline
character. Instead, after adding a newline, add some indentation (if any
can be found) also.

This mimics the behavior from Vim.
kakapo-ret-and-indent: trim whitespace aggressively

We now delete whitespace, regardless of the location of point. This
fixes the area where point was within the indentation.