Subject: 23: py-indent-region broken
From: David Reitter <[email-masked]>
To: Bug-Gnu-Emacs <[email-masked]>
Date: Tue, 27 Apr 2010 21:50:52 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

X-Debbugs-Cc: Warren Harris <[email-masked]>

py-indent-region seems dysfunctional when we're at column 0.

Enter this:

if 1=1:
print 5
print 8
if 1=1:
    print 6
else:
    print 6
    print 5

Then mark lines  2-5 (incl), which could be seen as a consistently indented block of code that was pasted there. C-c TAB should now shift it to the right, but it does nothing.

Contrast this with a situation where the block is already indented:

if 0=0:
    if 1=1:
    print 5
    print 8
    if 1=1:
        print 6
else:
    print 6
    print 5

Select lines 3-6 (incl) and hit C-c TAB.  Works.

This is python.el from lisp/progmodes.

Begin forwarded message:

> From: Warren Harris <[email-masked]>
> Date: April 27, 2010 6:41:23 PM EDT
> To: Bug reports for Aquamacs Emacs <[email-masked]>
> Cc: David Reitter <[email-masked]>
> Subject: Re: [Aquamacs-bugs] 23.1.93; cursor column position not preserved across short lines

> 3. indent-region in python mode does nothing. (This happens in 2.0b5 too.) However, line-by-line indention (with tab) works.

In GNU Emacs 23.1.96.48 (x86_64-apple-darwin10.3.0, NS apple-appkit-1038.29)
of 2010-04-26 on scarlett.local - Aquamacs Distribution 2.0preview6
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  which-function-mode: t
  savehist-mode: t
  smart-frame-positioning-mode: t
  aquamacs-autoface-mode: t
  recentf-mode: t
  osx-key-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  pc-selection-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
- I N D E N T - R E G <tab> <return> ^C <tab> <down-mouse-1> 
<mouse-movement> <mouse-1> <switch-frame> <down-mouse-1> 
<mouse-1> <double-down-mouse-1> <mouse-movement> <mouse-movement> 
<double-drag-mouse-1> <down-mouse-1> <mouse-movement> 
<drag-mouse-1> ^H F <return> <wheel-down> <wheel-down> 
<wheel-down> <double-wheel-down> <wheel-down> <double-wheel-down> 
<wheel-down> <double-wheel-down> <wheel-down> <double-wheel-down> 
<switch-frame> <up> <up> <up> <up> <S-down> ^C <tab> 
<up> <up> <S-down> <S-down> ^C <tab> <up> <S-down> 
<S-down> ^C <tab> <down> <up> <up> <left> <backspace> 
<backspace> <backspace> <up> <right> <down> E L S E 
: <return> P R I N T SPC 6 <up> <up> <up> <down> <return> 
P R I N T SPC 8 <return> I F SPC 1 = 1 : <return> <tab> 
P R I N T SPC 6 <up> <up> <up> <up> <up> <right> <down> 
<S-down> <S-down> <S-down> <S-down> ^C <tab> <up> <up> 
<up> <up> <up> <S-down> <S-down> <S-down> <S-down> 
<S-down> ^C <tab> <switch-frame> <wheel-down> <double-wheel-down> 
<triple-wheel-down> <wheel-down> <wheel-down> <wheel-down> 
<wheel-up> <double-wheel-up> <triple-wheel-up> <triple-wheel-up> 
<triple-wheel-up> <wheel-down> <double-wheel-down> 
<triple-wheel-down> <triple-wheel-down> <triple-wheel-down> 
<switch-frame> ^C > <up> <up> <up> <up> <up> <up> <down> 
<up> I F SPC 0 = 0 : <right> <S-down> <S-down> <S-down> 
<S-down> <up> <up> <up> <S-down> <S-down> <S-down> 
<S-down> ^C <tab> <S-up> <S-up> <S-up> <S-up> ^C <tab> 
<up> ⌘Z <up> <up> <up> <up> <up> <up> <up> <S-down> 
<backspace> <S-down> <S-down> <S-down> <S-down> <S-down> 
^C < <S-up> <S-up> <S-up> <S-up> <S-up> ^C <tab> <S-down> 
^C <tab> <down> <up> <down> <down> <down> <up> <up> 
<up> SPC ⌘Z ⌘A ⌘C <ns-application-activated> <down-mouse-1> 
<mouse-movement> <mouse-1> <down-mouse-1> <mouse-1> 
<return> <up> I F SPC 0 = 0 : <right> <S-down> <S-down> 
<S-down> <S-down> <S-down> ^C > ⌘A ⌘C <ns-application-activated> 
<down> <down> <S-down> <S-down> <S-down> <S-down> ^C 
<tab> ⌘Z <S-up> <S-up> <down> <up> <up> <up> <up> <S-down> 
<S-down> <S-down> <S-down> <S-down> ^C <tab> ^C <tab> 
<up> ⌘Z ⌘Z ⌘Z ⌘Z <down> <S-down> <S-down> <S-down> 
<S-down> ^C <tab> <ns-application-activated> <menu-bar> 
<help-menu> <bug-diagnosis> <send-emacs-bug-report
>

Recent messages:
Undo...
Undo!
Undo...
Undo!
Undo...
Undo!
Undo...
Undo!
Undo...
Undo!

Load-path shadows:
/Users/dr/Library/Preferences/Aquamacs Emacs/Recent Files hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/Recent Files
/Users/dr/Library/Preferences/Aquamacs Emacs/Preferences hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/Preferences
/Users/dr/Library/Preferences/Aquamacs Emacs/places hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/places
/Users/dr/Library/Preferences/Aquamacs Emacs/minibuffer-history hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/minibuffer-history
/Users/dr/Library/Preferences/Aquamacs Emacs/frame-positions hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/frame-positions
/Users/dr/Library/Preferences/Aquamacs Emacs/customizations hides /Users/dr/Library/Preferences/Aquamacs Emacs/Aquamacs Emacs2/customizations
/Users/dr/Library/Application Support/Aquamacs Emacs/JDEE/site-start hides /Library/Application Support/Aquamacs Emacs/SLIME/site-start
/Users/dr/Library/Application Support/Aquamacs Emacs/JDEE/site-start hides /Users/dr/ae.git/nextstep/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
mm-util mail-prsvr gmm-utils mailheader canlock sha1 hex-util hashcash
mail-utils emacsbug jka-compr find-func python-mode info-look info
ansi-color compile animate eldoc slime-banner slime-asdf slime-fancy
slime-fontifying-fu slime-package-fu slime-references slime-xref-browser
slime-scratch slime-presentations slime-highlight-edits slime-fuzzy
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-parse slime-repl slime derived apropos edmacro kmacro hideshow
hyperspec ess-help skeleton newcomment ess-toolbar ess-mous mouseme
browse-url ess-menu ess-swv ess-noweb noweb-font-lock-mode essl-bugs
essd-omg essl-omg essd-els essd-sas essl-sas essa-sas executable shell
essd-arc essd-vst essd-xls essl-lsp essd-sta essl-sta make-regexp
essd-sp6 essd-sp5 essd-sp3 essd-r essd-r-args essl-s ess-inf ess-utils
comint ess-mode noweb-mode ess ess-cust ess-emcs ess-site cc-mode
cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
log-edit ring pcvs-util add-log diff-mode vc vc-dispatcher pp
multi-isearch vc-git which-func imenu slime-autoloads load-emacs-plugins
aquamacs-mode-defaults auctex-config server tex-site smart-dnd
aquamacs-aux savehist mouse-sel one-buffer-one-frame
smart-frame-positioning drews_init color-theme-autoloads saveplace
visual-line aquamacs-bug aquamacs-autoface-mode aquamacs-editing
sendmail recentf tree-widget cus-edit osxkeys emulate-mac-keyboard-mode
frame-cmds strings misc-fns thingatpt+ thingatpt frame-fns avoid
aquamacs-mac-fontsets fit-frame aquamacs-frame-setup aquamacs-tabbar
tabbar-window cl cl-19 tabbar easy-mmode cus-start cus-load
load-emacs-pre-plugins aquamacs-site-start cocoa-compatibility filladapt
aquamacs-redo check-for-updates aquamacs-menu osx_defaults
aquamacs-tool-bar aquamacs mac-extra-functions aquamacs-tools
aquamacs-macros parse-time timezone time-date paren delsel pc-select
cua-base wid-edit regexp-opt advice advice-preload byte-opt bytecomp
byte-compile debug help-fns help-mode view image-file disp-table tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote
make-network-process ns multi-tty emacs)

Command line: (/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/MacOS/Aquamacs)

PATH: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/lib/postgresql82/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin:/Users/dr/Applications:/Users/dr/Applications/bin:/Users/dr/Projects/openccg/bin:/usr/texbin/powerpc-apple-darwin-current:/usr/local/git/bin:/Developer/Platforms/iPhoneFOSS.platform/Developer/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/usr/local/texlive/2009/bin

exec-path: (/opt/local/bin /opt/local/sbin /opt/local/bin /opt/local/sbin /opt/local/bin /opt/local/sbin /Library/Frameworks/Python.framework/Versions/Current/bin /opt/local/lib/postgresql82/bin /opt/local/bin /opt/local/sbin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/git/bin /usr/texbin /usr/X11/bin /Users/dr/Applications /Users/dr/Applications/bin /Users/dr/Projects/openccg/bin /usr/texbin/powerpc-apple-darwin-current /usr/local/git/bin /Developer/Platforms/iPhoneFOSS.platform/Developer/bin /usr/bin /bin /usr/sbin /sbin /Users/dr/ae.git/nextstep/Aquamacs.app/Contents/MacOS/bin /usr/local/texlive/2009/bin)