diff options
author | Pierre Courtieu <Pierre.Courtieu@cnam.fr> | 2015-11-30 18:51:12 +0100 |
---|---|---|
committer | Pierre Courtieu <Pierre.Courtieu@cnam.fr> | 2015-11-30 18:51:12 +0100 |
commit | b96a2c3ea17b90868f274586a5fad2639122a2ef (patch) | |
tree | bbd09f9465a3b420c65cca324e22e0c58684aeec /coq/coq-smie.el | |
parent | 2016f5f71f497bc7906c945b088ad93689ffd2bf (diff) |
Speeding up indentation code (smie lexer).
Diffstat (limited to 'coq/coq-smie.el')
-rw-r--r-- | coq/coq-smie.el | 11 |
1 files 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))) |