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

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

Re: Indentation in python.el after "Enter"


From: Eli Zaretskii
Subject: Re: Indentation in python.el after "Enter"
Date: Wed, 11 Jul 2007 05:46:51 -0400

> Date: Wed, 11 Jul 2007 14:07:13 +0500
> From: "Alexander Tsamutali" <astsmtl@gmail.com>
> 
> I added the following to my .emacs:
> 
> (add-hook 'python-mode-hook
>           (lambda () (define-key python-mode-map "\C-m" 'newline-and-indent)))
> 
> Then i found solution to my problem on EmacsWiki
> (http://www.emacswiki.org/cgi-bin/wiki/PythonMode)
> They recommend to add the following to .emacs:
> 
> (define-key python-mode-map "\C-m" 'newline-and-indent)
> 
> I can guess that first variant modifies key bindings only in python
> mode and second modifies key bindings globally. Am i right?

No, they both bind the Enter key in Python mode only, but the Wiki
solution requires that you load python.el in your .emacs, before you
bind the key, because otherwise python-mode-map is not defined, and
Emacs will barf.

The add-hook method is the better one, because it binds the key
whenever a buffer enters the Python mode, exactly when you need that.




reply via email to

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