From c7420a4bd7ec3e80c7f5df4c07f25c5b77d07e83 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 20 Nov 2019 11:27:26 +0700 Subject: [PATCH] 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 --- core/core-editor.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/core-editor.el b/core/core-editor.el index e71dd4d4f..e98606e5f 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -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)