help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I have my electric cake and eat it too? (Python mode question)


From: Stefan Monnier
Subject: Re: Can I have my electric cake and eat it too? (Python mode question)
Date: Tue, 31 Jan 2017 09:54:17 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> figured out I needed to call (electric-indent-mode) in my python-mode-hook.

electric-indent-mode is a *global* mode, so putting it into a major
mode' hook doesn't make sense.

> Done. Now, however, C-j (bound to electric-newline-and-maybe-indent) no
> longer indents. The doc for that function says, "Insert a newline. If
> `electric-indent-mode' is enabled, that's it..."

electric-indent-mode swaps the meaning of RET and C-j, so just use RET
to do the "newline and indent".

> Even easier will be the just bind C-j to 'newline-and-indent' in my
> python-mode-map. :-)

Or in the global-map.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]