all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Ola Nilsson <ola.nilsson@gmail.com>, 30277@debbugs.gnu.org
Subject: bug#30277: 26.0.91; Infinite recursion in python-nav-beginning-of-statement
Date: Thu, 1 Feb 2018 15:28:36 +0300	[thread overview]
Message-ID: <5a08be28-3a08-40b9-aa56-dd64e3a0650d@yandex.ru> (raw)
In-Reply-To: <CAKyOKyFKto1w7HYvfMT_jNbgH1XTVHXk1S8Ko=GqWTD2NW2sxQ@mail.gmail.com>

Hi!

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))
           (context-point
            (or
@@ -1489,6 +1489,7 @@ python-nav-beginning-of-statement
               (python-info-line-ends-backslash-p))
             (forward-line -1)
             (python-nav-beginning-of-statement))))
+  (back-to-indentation)
    (point-marker))

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





  parent reply	other threads:[~2018-02-01 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-28 22:42 bug#30277: 26.0.91; Infinite recursion in python-nav-beginning-of-statement Ola Nilsson
2018-01-29 21:09 ` Noam Postavsky
2018-02-01 12:28 ` Dmitry Gutov [this message]
2018-02-10 11:26   ` Eli Zaretskii
2018-02-12  0:28     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a08be28-3a08-40b9-aa56-dd64e3a0650d@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=30277@debbugs.gnu.org \
    --cc=ola.nilsson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.