0

I've put together a simple major mode for syntax highlighting and indentation of AQL. This is my first, and I'm open to any suggestions there, but my question is more specific:

When I type two slashes to begin a comment, the moment I type the second slash the cursor jumps back to the beginning of the line, and the line is indented.

This even happens if I've already typed a bunch of code on the line. So if I have the following line (^ is the cursor):

for u in users
              ^

and then I start to put a comment at the end of the line, the moment I type two slashes the cursor jumps:

for u in users \\
^

What's going on here? I've tried playing with and disabling electric-indent-mode, and I've tried manipulating electric-indent-chars but have not been able to alter this behavior in any way.

Any thoughts on how to proceed?

0

Hmm found a workable solution Based on this answer

https://stackoverflow.com/questions/11061453/in-emacs-how-to-disable-comment-auto-indent-in-c-c

I added the following to the mode's keymap (called custom-map below)

(define-key custom-map "/" 'self-insert-command)
(define-key custom-map "*" 'self-insert-command)

And all is resolved. Not sure if this is the right way, but it seems to work...

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.