diff options
author | João Távora <joaotavora@gmail.com> | 2021-09-19 11:42:20 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2021-09-21 10:56:27 +0100 |
commit | 0646c6817139aa905a2f6079fdc82eb4be944de0 (patch) | |
tree | 99744a6d07ea4486b2abd0911c9aa3c22de96747 /test/lisp/progmodes/python-tests.el | |
parent | 9ad962e118a17daf073ef5308233f9301755035d (diff) | |
download | emacs-0646c6817139aa905a2f6079fdc82eb4be944de0.tar.gz emacs-0646c6817139aa905a2f6079fdc82eb4be944de0.tar.bz2 emacs-0646c6817139aa905a2f6079fdc82eb4be944de0.zip |
Make syntax-ppss more accurate for Python triple quotes (bug#49518)
By putting delimiter syntax on the last character of Python
triple-quoted strings, this makes syntax-ppss be more accurate.
Previously:
emacs -Q something.py
type two single quotes
M-: (nth 3 (syntax-ppss))
notice how the return value says you're outside a string, correctly
type another quote
M-: (nth 3 (syntax-ppss))
notice how the return value says you're inside a string, correctly
backspace the quote just entered
M-: (nth 3 (syntax-ppss))
notice how the return value says you're inside a string, incorrectly
With this patch the last step is corrected. This helps things like
electric-pair-mode. Also, the test
python-syntax-after-python-backspace now passes, again.
* lisp/progmodes/python.el (python-syntax-stringify): Put
delimiter syntax in "inner" of the surrouding triple quotes.
* test/lisp/progmodes/python-tests.el
(python-syntax-after-python-backspace): Passes again.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r-- | test/lisp/progmodes/python-tests.el | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index afdae4c75c6..6ab9c62746e 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -193,7 +193,6 @@ aliqua." (ert-deftest python-syntax-after-python-backspace () ;; `python-indent-dedent-line-backspace' garbles syntax - :expected-result :failed (python-tests-with-temp-buffer "\"\"\"" (goto-char (point-max)) |