diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 290cdc8120d..f9b28c322c8 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -4892,12 +4892,19 @@ point's current `syntax-ppss'." | |||
| 4892 | ;; Allow up to two consecutive docstrings only. | 4892 | ;; Allow up to two consecutive docstrings only. |
| 4893 | (>= | 4893 | (>= |
| 4894 | 2 | 4894 | 2 |
| 4895 | (progn | 4895 | (let (last-backward-sexp-point) |
| 4896 | (while (save-excursion | 4896 | (while (save-excursion |
| 4897 | (python-nav-backward-sexp) | 4897 | (python-nav-backward-sexp) |
| 4898 | (setq backward-sexp-point (point)) | 4898 | (setq backward-sexp-point (point)) |
| 4899 | (and (= indentation (current-indentation)) | 4899 | (and (= indentation (current-indentation)) |
| 4900 | (not (bobp)) ; Prevent infloop. | 4900 | ;; Make sure we're always moving point. |
| 4901 | ;; If we get stuck in the same position | ||
| 4902 | ;; on consecutive loop iterations, | ||
| 4903 | ;; bail out. | ||
| 4904 | (prog1 (not (eql last-backward-sexp-point | ||
| 4905 | backward-sexp-point)) | ||
| 4906 | (setq last-backward-sexp-point | ||
| 4907 | backward-sexp-point)) | ||
| 4901 | (looking-at-p | 4908 | (looking-at-p |
| 4902 | (concat "[uU]?[rR]?" | 4909 | (concat "[uU]?[rR]?" |
| 4903 | (python-rx string-delimiter))))) | 4910 | (python-rx string-delimiter))))) |