Speed up indent guessing

Guessing the indentation can be awfully slow because it scans the whole
buffer. This PR overrides the guessing mechanism to scan at most 10000
points.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
This commit is contained in:
Rudi Grinberg 2019-11-20 11:27:26 +07:00
parent d474223a99
commit c7420a4bd7

View file

@ -358,6 +358,10 @@ files, so we replace calls to `pp' with the much faster `prin1'."
:around #'dtrt-indent-mode
(let ((dtrt-indent-run-after-smie dtrt-indent-run-after-smie))
(cl-letf* ((old-smie-config-guess (symbol-function 'smie-config-guess))
(old-smie-config--guess (symbol-function 'symbol-config--guess))
((symbol-function 'symbol-config--guess)
(lambda (beg end)
(funcall old-smie-config--guess beg (min end 10000))))
((symbol-function 'smie-config-guess)
(lambda ()
(condition-case e (funcall old-smie-config-guess)