Skip to content

Commit 588aeeb

Browse files
committed
Fix php-mode-test--buffer-face-list for long code
When jit-mode is enabled, face is not set for characters outside the screen. Explicitly invalidate jit-mode by creating a temporary buffer.
1 parent 811603f commit 588aeeb

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

php-mode-test.el

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,25 @@ be processed."
8080

8181
(defun php-mode-test--buffer-face-list (buffer)
8282
"Return list of (STRING . FACE) from `BUFFER'."
83-
(with-current-buffer buffer
84-
(save-excursion
85-
(goto-char (point-min))
86-
(let (retval begin-pos last-face current-face str)
87-
(setq last-face (get-text-property (point) 'face))
88-
(setq begin-pos (point))
89-
(forward-char 1)
90-
91-
(while (< (point) (point-max))
92-
(setq current-face (get-text-property (point) 'face))
93-
(unless (equal current-face last-face)
94-
(setq str (buffer-substring-no-properties begin-pos (point)))
95-
(setq retval (nconc retval (list (cons str last-face))))
96-
(setq begin-pos (point))
97-
(setq last-face current-face))
98-
(forward-char 1))
99-
(setq str (buffer-substring-no-properties begin-pos (point)))
100-
(nconc retval (list (cons str last-face)))))))
83+
(with-temp-buffer
84+
(jit-lock-mode -1)
85+
(insert (with-current-buffer buffer (buffer-substring (point-min) (point-max))))
86+
(goto-char (point-min))
87+
(let (retval begin-pos last-face current-face str)
88+
(setq last-face (get-text-property (point) 'face))
89+
(setq begin-pos (point))
90+
(forward-char 1)
91+
92+
(while (< (point) (point-max))
93+
(setq current-face (get-text-property (point) 'face))
94+
(unless (equal current-face last-face)
95+
(setq str (buffer-substring-no-properties begin-pos (point)))
96+
(setq retval (nconc retval (list (cons str last-face))))
97+
(setq begin-pos (point))
98+
(setq last-face current-face))
99+
(forward-char 1))
100+
(setq str (buffer-substring-no-properties begin-pos (point)))
101+
(nconc retval (list (cons str last-face))))))
101102

102103
(defun php-mode-test--parse-list-file (file-path)
103104
"Return list from `FILE-PATH'."

0 commit comments

Comments
 (0)