From 0646c6817139aa905a2f6079fdc82eb4be944de0 Mon Sep 17 00:00:00 2001 From: João Távora Date: Sun, 19 Sep 2021 11:42:20 +0100 Subject: 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. --- test/lisp/progmodes/python-tests.el | 1 - 1 file changed, 1 deletion(-) (limited to 'test/lisp/progmodes/python-tests.el') 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)) -- cgit v1.2.3