diff options
author | kobarity <kobarity@gmail.com> | 2023-03-05 17:06:26 +0900 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-03-09 12:12:27 +0200 |
commit | f175141aeade5d6795d22d40c1eb001c6ba49025 (patch) | |
tree | a829f2e2e9700d91a4bacb0cb2b098aeab53cdab /lisp/progmodes/python.el | |
parent | 7e1012765c40a10a8a051c39566778913dc7e224 (diff) | |
download | emacs-f175141aeade5d6795d22d40c1eb001c6ba49025.tar.gz |
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." (goto-char (+ (point) (python-syntax-count-quotes (char-after (point)) (point)))) - (setq last-string-end - (or (re-search-forward - (rx (syntax string-delimiter)) nil t) - (goto-char (point-max))))))) + (setq + last-string-end + (or (if (eq t (nth 3 (syntax-ppss))) + (re-search-forward + (rx (syntax string-delimiter)) nil t) + (ignore-error scan-error + (goto-char string-start) + (python-nav--lisp-forward-sexp) + (point))) + (goto-char (point-max))))))) ((python-syntax-context 'paren) ;; The statement won't end before we've escaped ;; at least one level of parenthesis. |