Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f19feb8

Browse files
committed
(py-mode-map): Add back force of RET (aka C-m) to
py-newline-and-indent.
1 parent 1c4d96f commit f19feb8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Misc/python-mode.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ Currently-active file is at the head of the list.")
489489
(mapcar #'(lambda (key)
490490
(define-key py-mode-map key 'py-newline-and-indent))
491491
(where-is-internal 'newline-and-indent))
492+
;; Force RET to be py-newline-and-indent even if it didn't get
493+
;; mapped by the above code. motivation: Emacs' default binding for
494+
;; RET is `newline' and C-j is `newline-and-indent'. Most Pythoneers
495+
;; expect RET to do a `py-newline-and-indent' and any Emacsers who
496+
;; dislike this are probably knowledgeable enough to do a rebind.
497+
;; However, we do *not* change C-j since many Emacsers have already
498+
;; swapped RET and C-j and they don't want C-j bound to `newline' to
499+
;; change.
500+
(define-key py-mode-map "\C-m" 'py-newline-and-indent)
492501
)
493502

494503
(defvar py-mode-output-map nil

0 commit comments

Comments
 (0)