Recently I write quite a lot comments for c/c++ files. I use auto-fill-mode for comment auto format. But I found a quite annoying problem: whenever I input SPC at the end of a comment line, the cursor just sticks to the end of the last word in the line, as the screenshot shows below:

auto-fill in c block comment

Strangely, this only happens in block style /**/ comment. If I use line comment //, auto-fill won't prevent cursor from moving:

auto-fill in c line comment

Since I made the screenshot with emacs -q, I am sure this is the default behaviour of auto-fill-mode with emacs 26.2. Can anyone tell me how to prevent such annoying default behaviour?

  • With more debugging, I found this only happens when the last line of block comment is ` * */`. – chihyang Oct 2 '19 at 0:58

Your Answer

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

Browse other questions tagged or ask your own question.