From 17b43cf36c58bb396bf269762fb081af1e08f736 Mon Sep 17 00:00:00 2001 From: nitishch Date: Fri, 6 Apr 2018 08:01:14 +0530 Subject: [PATCH] 30822: Fixed infinite loop and also removed an extra call to forward-line --- lisp/progmodes/python.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index afafd1b42c..3043428413 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3163,9 +3163,13 @@ python-shell-send-defun (beginning-of-line 1)) (> (current-indentation) 0))) (when (not arg) - (while (and (forward-line -1) - (looking-at (python-rx decorator)))) - (forward-line 1)) + (while (and + ;; Make sure forward-line actually moves Point + (eq (forward-line -1) 0) + ;; If Point is at a decorator, loop. + ;; else, move one line down and exit the loop. + (or (looking-at (python-rx decorator)) + (and (forward-line 1) nil))))) (point-marker)) (progn (or (python-nav-end-of-defun) -- 2.16.2