diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ccbcb081305..d2eb5f268bd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -5129,21 +5129,22 @@ point's current `syntax-ppss'." | |||
| 5129 | (>= | 5129 | (>= |
| 5130 | 2 | 5130 | 2 |
| 5131 | (let (last-backward-sexp-point) | 5131 | (let (last-backward-sexp-point) |
| 5132 | (while (save-excursion | 5132 | (while (and (<= counter 2) |
| 5133 | (python-nav-backward-sexp) | 5133 | (save-excursion |
| 5134 | (setq backward-sexp-point (point)) | 5134 | (python-nav-backward-sexp) |
| 5135 | (and (= indentation (current-indentation)) | 5135 | (setq backward-sexp-point (point)) |
| 5136 | ;; Make sure we're always moving point. | 5136 | (and (= indentation (current-indentation)) |
| 5137 | ;; If we get stuck in the same position | 5137 | ;; Make sure we're always moving point. |
| 5138 | ;; on consecutive loop iterations, | 5138 | ;; If we get stuck in the same position |
| 5139 | ;; bail out. | 5139 | ;; on consecutive loop iterations, |
| 5140 | (prog1 (not (eql last-backward-sexp-point | 5140 | ;; bail out. |
| 5141 | backward-sexp-point)) | 5141 | (prog1 (not (eql last-backward-sexp-point |
| 5142 | (setq last-backward-sexp-point | 5142 | backward-sexp-point)) |
| 5143 | backward-sexp-point)) | 5143 | (setq last-backward-sexp-point |
| 5144 | (looking-at-p | 5144 | backward-sexp-point)) |
| 5145 | (concat "[uU]?[rR]?" | 5145 | (looking-at-p |
| 5146 | (python-rx string-delimiter))))) | 5146 | (concat "[uU]?[rR]?" |
| 5147 | (python-rx string-delimiter)))))) | ||
| 5147 | ;; Previous sexp was a string, restore point. | 5148 | ;; Previous sexp was a string, restore point. |
| 5148 | (goto-char backward-sexp-point) | 5149 | (goto-char backward-sexp-point) |
| 5149 | (cl-incf counter)) | 5150 | (cl-incf counter)) |