unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Can I have my electric cake and eat it too? (Python mode question)
Date: Tue, 31 Jan 2017 09:54:17 -0500	[thread overview]
Message-ID: <jwvefzjffm5.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CANc-5UxY14mLnB1fHYCymz4fb9LOzFb0dz9av+Q9KVGroSqMBA@mail.gmail.com

> 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




  parent reply	other threads:[~2017-01-31 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 21:23 Can I have my electric cake and eat it too? (Python mode question) Skip Montanaro
2017-01-30 21:28 ` Skip Montanaro
2017-01-31 14:54 ` Stefan Monnier [this message]
2017-01-31 18:06   ` Skip Montanaro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvefzjffm5.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).