summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2023-06-02 22:52:57 +0900
committerEli Zaretskii <eliz@gnu.org>2023-06-03 10:09:33 +0300
commit6b2c8dc9050c5c0514fa404733ce1d4a37d00e39 (patch)
treefe44b5ae27d89cccbcad97efda16fa063ac5fe1c /test/lisp
parent348e4504c6d5588443809ec28da3c3c693368e16 (diff)
downloademacs-6b2c8dc9050c5c0514fa404733ce1d4a37d00e39.tar.gz
emacs-6b2c8dc9050c5c0514fa404733ce1d4a37d00e39.tar.bz2
emacs-6b2c8dc9050c5c0514fa404733ce1d4a37d00e39.zip
Revert "Enhance Python font-lock to support multilines"
This reverts commit 4915ca5dd4245a909c046e6691e8d4a1919890c8. We have found that there are performance issues when editing a large file. The issue can be reproduced as follows: 1. emacs -Q 2. Open large Python file (e.g. turtle.py in Python) 3. Near the top of the buffer, enter open paren and some characters. The above commit extends the region to be font-locked using `python-nav-end-of-statement'. However, if there are unbalanced parens, it may move point to the end of the buffer. This causes almost the entire buffer to be font-locked, which is not acceptable for large files.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/progmodes/python-tests.el144
1 files changed, 0 insertions, 144 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index cbaf5b698bd..e1b4c0a74c0 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -136,20 +136,6 @@ STRING, it is skipped so the next STRING occurrence is selected."
while pos
collect (cons pos (get-text-property pos 'face))))
-(defun python-tests-assert-faces-after-change (content faces search replace)
- "Assert that font faces for CONTENT are equal to FACES after change.
-All occurrences of SEARCH are changed to REPLACE."
- (python-tests-with-temp-buffer
- content
- ;; Force enable font-lock mode without jit-lock.
- (rename-buffer "*python-font-lock-test*" t)
- (let (noninteractive font-lock-support-mode)
- (font-lock-mode))
- (while
- (re-search-forward search nil t)
- (replace-match replace))
- (should (equal faces (python-tests-get-buffer-faces)))))
-
(defun python-tests-self-insert (char-or-str)
"Call `self-insert-command' for chars in CHAR-OR-STR."
(let ((chars
@@ -297,13 +283,6 @@ p = (1 + 2)
"def 1func():"
'((1 . font-lock-keyword-face) (4))))
-(ert-deftest python-font-lock-keywords-level-1-3 ()
- (python-tests-assert-faces
- "def \\
- func():"
- '((1 . font-lock-keyword-face) (4)
- (15 . font-lock-function-name-face) (19))))
-
(ert-deftest python-font-lock-assignment-statement-1 ()
(python-tests-assert-faces
"a, b, c = 1, 2, 3"
@@ -495,129 +474,6 @@ def f(x: CustomInt) -> CustomInt:
(136 . font-lock-operator-face) (137)
(144 . font-lock-keyword-face) (150))))
-(ert-deftest python-font-lock-assignment-statement-multiline-1 ()
- (python-tests-assert-faces-after-change
- "
-[
- a,
- b
-] # (
- 1,
- 2
-)
-"
- '((1)
- (8 . font-lock-variable-name-face) (9)
- (15 . font-lock-variable-name-face) (16)
- (19 . font-lock-operator-face) (20))
- "#" "="))
-
-(ert-deftest python-font-lock-assignment-statement-multiline-2 ()
- (python-tests-assert-faces-after-change
- "
-[
- *a
-] # 5, 6
-"
- '((1)
- (8 . font-lock-operator-face)
- (9 . font-lock-variable-name-face) (10)
- (13 . font-lock-operator-face) (14))
- "#" "="))
-
-(ert-deftest python-font-lock-assignment-statement-multiline-3 ()
- (python-tests-assert-faces-after-change
- "a\\
- ,\\
- b\\
- ,\\
- c\\
- #\\
- 1\\
- ,\\
- 2\\
- ,\\
- 3"
- '((1 . font-lock-variable-name-face) (2)
- (15 . font-lock-variable-name-face) (16)
- (29 . font-lock-variable-name-face) (30)
- (36 . font-lock-operator-face) (37))
- "#" "="))
-
-(ert-deftest python-font-lock-assignment-statement-multiline-4 ()
- (python-tests-assert-faces-after-change
- "a\\
- :\\
- int\\
- #\\
- 5"
- '((1 . font-lock-variable-name-face) (2)
- (15 . font-lock-builtin-face) (18)
- (24 . font-lock-operator-face) (25))
- "#" "="))
-
-(ert-deftest python-font-lock-assignment-statement-multiline-5 ()
- (python-tests-assert-faces-after-change
- "(\\
- a\\
-)\\
- #\\
- 5\\
- ;\\
- (\\
- b\\
- )\\
- #\\
- 6"
- '((1)
- (8 . font-lock-variable-name-face) (9)
- (18 . font-lock-operator-face) (19)
- (46 . font-lock-variable-name-face) (47)
- (60 . font-lock-operator-face) (61))
- "#" "="))
-
-(ert-deftest python-font-lock-assignment-statement-multiline-6 ()
- (python-tests-assert-faces-after-change
- "(
- a
-)\\
- #\\
- 5\\
- ;\\
- (
- b
- )\\
- #\\
- 6"
- '((1)
- (7 . font-lock-variable-name-face) (8)
- (16 . font-lock-operator-face) (17)
- (43 . font-lock-variable-name-face) (44)
- (56 . font-lock-operator-face) (57))
- "#" "="))
-
-(ert-deftest python-font-lock-operator-1 ()
- (python-tests-assert-faces
- "1 << 2 ** 3 == +4%-5|~6&7^8%9"
- '((1)
- (3 . font-lock-operator-face) (5)
- (8 . font-lock-operator-face) (10)
- (13 . font-lock-operator-face) (15)
- (16 . font-lock-operator-face) (17)
- (18 . font-lock-operator-face) (20)
- (21 . font-lock-operator-face) (23)
- (24 . font-lock-operator-face) (25)
- (26 . font-lock-operator-face) (27)
- (28 . font-lock-operator-face) (29))))
-
-(ert-deftest python-font-lock-operator-2 ()
- "Keyword operators are font-locked as keywords."
- (python-tests-assert-faces
- "is_ is None"
- '((1)
- (5 . font-lock-keyword-face) (7)
- (8 . font-lock-constant-face))))
-
(ert-deftest python-font-lock-escape-sequence-string-newline ()
(python-tests-assert-faces
"'\\n'