GNU bug report logs - #2703
23.0.91; Error in Python indenter

Previous Next

Package: emacs;

Reported by: Bob Rogers <rogers-perl6 <at> rgrjr.dyndns.org>

Date: Wed, 18 Mar 2009 01:30:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Marcus Dreier <m-rei <at> gmx.net>
Cc: 2703 <at> debbugs.gnu.org
Subject: bug#2703: 23.0.91; Error in Python indenter
Date: Wed, 09 Nov 2011 10:01:25 -0500
> The position check in the outer loop makes no sense to me.

Indeed it makes no sense.  I think the intention is to prevent
inf-looping, but it's done incorrectly.  I'm not 100% convinced that
your patch avoids inf-looping, so I reworked the code some more to make
the termination more clear.  It's also simpler.

Thanks for digging into it and finding the culprit.


        Stefan


=== modified file 'lisp/progmodes/python.el'
*** lisp/progmodes/python.el	2011-09-10 21:15:28 +0000
--- lisp/progmodes/python.el	2011-11-09 14:53:11 +0000
***************
*** 948,969 ****
    "Go to start of current statement.
  Accounts for continuation lines, multi-line strings, and
  multi-line bracketed expressions."
!   (beginning-of-line)
!   (python-beginning-of-string)
!   (let (point)
!     (while (and (python-continuation-line-p)
! 		(if point
! 		    (< (point) point)
! 		  t))
!       (beginning-of-line)
        (if (python-backslash-continuation-line-p)
! 	  (progn
! 	    (forward-line -1)
! 	    (while (python-backslash-continuation-line-p)
! 	      (forward-line -1)))
! 	(python-beginning-of-string)
! 	(python-skip-out))
!       (setq point (point))))
    (back-to-indentation))
  
  (defun python-skip-out (&optional forward syntax)
--- 948,959 ----
    "Go to start of current statement.
  Accounts for continuation lines, multi-line strings, and
  multi-line bracketed expressions."
!   (while
        (if (python-backslash-continuation-line-p)
!           (progn (forward-line -1) t)
!         (beginning-of-line)
!         (or (python-beginning-of-string)
!             (python-skip-out))))
    (back-to-indentation))
  
  (defun python-skip-out (&optional forward syntax)




This bug report was last modified 13 years and 192 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.