[BangPypers] Commenting code regions and indentation (Emacs, Python)

Noufal Ibrahim noufal at gmail.com
Fri Dec 9 07:52:54 CET 2011

Vikas BN <vikas.bn at gmail.com> writes:

> Hi All,
>   I use Emacs for my editing and python-mode.el specifically for
> python editing.

The mode that's *not* part of Emacs. Correct? 

>   However, I want to change the default behaviour of commenting
> regions in Emacs.
>   Currently, when I select a region and hit M-; Emacs comments out the
> region like so:
> def main():
>    if cond:
> #       a = b
> #       c = d
>    else:
>       foo = bar

I use python.el shipped as part of Emacs and I get the behaviour which
you prefer. I looked through python-mode.el and found a few comment
related settings that you can tweak which change indentation etc. for
comments. They're all there in the customize-mode buffer for the mode. I
tweaked them a little but couldn't see any obvious changes but I think
it has to do with the positions of point and mark in my buffer. You
could try those. python-honour-comment-indentation mainly. 



Hegel was right when he said that we learn from history that man can never learn anything from history. -George Bernard Shaw

More information about the BangPypers mailing list