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: Marcus Dreier
Subject: bug#2703: 23.0.91; Error in Python indenter
Date: Sat, 1 Oct 2011 15:19:10 +0200

This patch fixes the indentation problem like described in the
report. It also fixes the problem that the
python-beginning-of-statement function doesn't work correctly in the
same context.

Description:
The position check in the outer loop makes no sense to me. With this
check the outer loop goes only once through the body then the
condition is always false. That's wrong if the python code has more
than one continuation line that isn't a backslash continuation line.


Best regards,
  Marcus


=== modified file 'lisp/progmodes/python.el'
*** lisp/progmodes/python.el    2011-09-10 21:15:28 +0000
--- lisp/progmodes/python.el    2011-10-01 13:01:13 +0000
***************
*** 950,969 ****
  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)
--- 950,964 ----
  multi-line bracketed expressions."
    (beginning-of-line)
    (python-beginning-of-string)
!   (while (python-continuation-line-p)
!     (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)))
    (back-to-indentation))

  (defun python-skip-out (&optional forward syntax)





reply via email to

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