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

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

bug#2703: 23.0.91; Error in Python indenter


From: Stefan Monnier
Subject: bug#2703: 23.0.91; Error in Python indenter
Date: Wed, 09 Nov 2011 10:01:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

> 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)





reply via email to

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