diff options
| author | kobarity | 2023-03-05 17:06:26 +0900 |
|---|---|---|
| committer | Eli Zaretskii | 2023-03-09 12:12:27 +0200 |
| commit | f175141aeade5d6795d22d40c1eb001c6ba49025 (patch) | |
| tree | a829f2e2e9700d91a4bacb0cb2b098aeab53cdab /lisp/progmodes/python.el | |
| parent | 7e1012765c40a10a8a051c39566778913dc7e224 (diff) | |
| download | emacs-f175141aeade5d6795d22d40c1eb001c6ba49025.tar.gz emacs-f175141aeade5d6795d22d40c1eb001c6ba49025.zip | |
Fix searching for end of string in python-nav-end-of-statement
* lisp/progmodes/python.el (python-nav-end-of-statement): Add
searching for corresponding string-quote.
* test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-3)
(python-nav-end-of-statement-4, python-info-current-defun-4): New
tests. (Bug#58780)
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 630250c15c3..ccf78e13148 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2076,10 +2076,16 @@ of the statement." | |||
| 2076 | (goto-char (+ (point) | 2076 | (goto-char (+ (point) |
| 2077 | (python-syntax-count-quotes | 2077 | (python-syntax-count-quotes |
| 2078 | (char-after (point)) (point)))) | 2078 | (char-after (point)) (point)))) |
| 2079 | (setq last-string-end | 2079 | (setq |
| 2080 | (or (re-search-forward | 2080 | last-string-end |
| 2081 | (rx (syntax string-delimiter)) nil t) | 2081 | (or (if (eq t (nth 3 (syntax-ppss))) |
| 2082 | (goto-char (point-max))))))) | 2082 | (re-search-forward |
| 2083 | (rx (syntax string-delimiter)) nil t) | ||
| 2084 | (ignore-error scan-error | ||
| 2085 | (goto-char string-start) | ||
| 2086 | (python-nav--lisp-forward-sexp) | ||
| 2087 | (point))) | ||
| 2088 | (goto-char (point-max))))))) | ||
| 2083 | ((python-syntax-context 'paren) | 2089 | ((python-syntax-context 'paren) |
| 2084 | ;; The statement won't end before we've escaped | 2090 | ;; The statement won't end before we've escaped |
| 2085 | ;; at least one level of parenthesis. | 2091 | ;; at least one level of parenthesis. |