From b96a2c3ea17b90868f274586a5fad2639122a2ef Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Mon, 30 Nov 2015 18:51:12 +0100 Subject: Speeding up indentation code (smie lexer). --- coq/coq-smie.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/coq/coq-smie.el b/coq/coq-smie.el index 088da078..2dc5482c 100644 --- a/coq/coq-smie.el +++ b/coq/coq-smie.el @@ -35,6 +35,13 @@ (require 'coq-indent) (require 'smie nil 'noerror) +(defmacro measure-time (&rest body) + "Measure the time it takes to evaluate BODY." + `(let ((time (current-time))) + ,@body + (message "%.06f" (float-time (time-since time))))) + + (defun coq-string-suffix-p (str1 str2 &optional ignore-case) "Return non-nil if STR1 is a prefix of STR2. If IGNORE-CASE is non-nil, the comparison is done without paying @@ -202,7 +209,7 @@ command (and inside parenthesis)." (equal (char-syntax ?\)) (char-syntax (char-after))))) (throw 'found nil)) ((zerop (length next)) ;; capture other characters than closing parent - (forward-sexp 1)) + (let ((forward-sexp-function nil)) (forward-sexp -1))) ((member next tokens) (throw 'found next)))))))) (scan-error nil))) @@ -249,7 +256,7 @@ command (and inside parenthesis). " (or (equal (point) (point-min)) ; protecting char-before next line (equal (char-syntax ?\() (char-syntax (char-before))))) (throw 'found nil)) - ((zerop (length next)) (forward-sexp -1)) + ((zerop (length next)) (let ((forward-sexp-function nil)) (forward-sexp -1))) ((member next tokens) (throw 'found next)))))))) (scan-error nil))) -- cgit v1.2.3