How to handle the enter key while inside of comment blocks

This post reveals a nice function comment-indent-new-line which gives you the
right kind of indentation for block comments. That got me wondering if my
enter key-binding should do different things depending upon whether or not the
cursor is inside of a comment block or not. Specifically, if it is, then call
the aforementioned function, else call the normal binding. This seems that it
might be an improvement

This post explains how to check if the cursor is inside of a comment block:

(nth 4 (syntax-ppss))

It is not nil when the point (cursor) is inside of a comment block.

Great to know.

I decided not to make this change yet, but, I wanted to capture how, here.

3 thoughts on “How to handle the enter key while inside of comment blocks”

Leave a Reply

Your email address will not be published. Required fields are marked *