1

While typing in a SQL mode buffer, I noticed that -* starts a block comment. Why?

It happens whenever I type an asterisk/star character (ASCII 42) directly after a simple dash/hyphen/minus character (ASCII 45).

I thought it might be due to -*- something -*- buffer hints, but it does not happen in other modes like C++ mode, so it seems to be something else. It does not depend on the SQL dialect I choose.

I tried searching in code but gave up as -* gave way too many hits (match zero or more dashes) and -\* gave none.

Maybe it's because - is the first (and second) character of a comment-start sequence (--) and * is the second character of a comment-start sequence (/*). I used M-x describe-char to find this. Following this rationale *- should work as a comment-end sequence, but it does not.

I only tested GNU Emacs version 26.2 (on Windows).

Is there any way to fix this behavior?

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.