Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Emacs less aggressive about indentation

Emacs reindents the current line whenever I type certain things, like ";" or "//". This is pretty annoying, since there are a whole lot of places where it isn't smart enough to indent correctly.

How do I disable this feature? I still want to be able to indent the line with TAB, but I don't want any source code I type to cause it to reindent.

(I'm using Dylan Moonfire's C# mode, but this probably applies to any cc-mode.)

like image 796
Ken Avatar asked Dec 29 '22 16:12

Ken


2 Answers

Try running c-toggle-electric-state to turn off the electric action of these characters.

You can do this as part of a c-mode-common-hook, or toggle the state manually by hitting C-c C-l.

like image 50
Blair Conrad Avatar answered Jan 04 '23 23:01

Blair Conrad


most likely caused by the inline-and-indent 'feature' of c-mode and derivatives. emacswiki has several solutions.

like image 36
Steen Avatar answered Jan 05 '23 00:01

Steen