[Top][All Lists]

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

bug#30277: 26.0.91; Infinite recursion in python-nav-beginning-of-statem

From: Dmitry Gutov
Subject: bug#30277: 26.0.91; Infinite recursion in python-nav-beginning-of-statement
Date: Thu, 1 Feb 2018 15:28:36 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Thunderbird/58.0


On 1/29/18 1:42 AM, Ola Nilsson wrote:
The infinite recursion is triggered when the first line of a
python-mode buffer starts with space and ends with a backslash.

With emacs -Q

* create a new buffer
* M-x python-mode
* Insert SPACE \ ENTER

=> Lisp nesting exceeds ‘max-lisp-eval-depth’

The infinite recursion is also triggered if the first line of a narrowed
region starts with space and ends on a backslash.

This seems to fix it for me. Please test thoroughly, I rarely ever use python-mode myself.

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5baf6e0f80..ff8269d970 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1474,7 +1474,7 @@ python-nav-forward-defun
 (defun python-nav-beginning-of-statement ()
   "Move to start of current statement."
   (interactive "^")
-  (back-to-indentation)
+  (forward-line 0)
   (let* ((ppss (syntax-ppss))
@@ -1489,6 +1489,7 @@ python-nav-beginning-of-statement
            (forward-line -1)
+  (back-to-indentation)

 (defun python-nav-end-of-statement (&optional noend)

reply via email to

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