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

Vikas BN vikas.bn at gmail.com
Fri Dec 9 07:26:49 CET 2011

Hi All,

  I use Emacs for my editing and python-mode.el specifically for python editing.

  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
      foo = bar

  Note how the comment starts at the beginning of the line
irrespective of how "deep" the region is.
  I want something more like so (comment char is aligned to the
indented block of code):

def main():
   if cond:
   #  a = b
   #  c = d
      foo = bar

  Anybody has ideas on how to achieve this?


More information about the BangPypers mailing list