GNU bug report logs -
#24205
25.1.50; Re-display issue (lag) when opening certain files [sml-mode]
Previous Next
Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>
Date: Thu, 11 Aug 2016 17:05:01 UTC
Severity: normal
Found in version 25.1.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> (* ''a is a special equality type (it is not the same as the generic 'a
> type. It *)
Apparently, it's the following font-lock rule which takes forever:
(,(concat "\\_<\\(\\(?:data\\|abs\\|with\\|eq\\)?type\\)\\s-+"
sml-tyvarseq-re "\\(" sml-id-re "\\)")
(1 font-lock-keyword-face)
(2 font-lock-type-def-face))
The sml-tyvarseq-re part of it matches type annotation which typically
take the form ('a, 'b), so it normally matches things like
datatype ('a, 'b) foo
or
type ('a, 'b) foo
and the regexp is loose enough to match any mix of , ' and identifiers
inside parentheses. This in itself is not a big problem, except that
the regexp is not careful enough and match "abc" either as a single
identifier, or as 2 identifiers (in two different ways: "a" followed by
"bc" or "ab" "followed by "c"), or as 3 identifiers. For longish words
like "generic" you can guess that it ends up with very many different
ways to match, so when the match fails, it takes many trials to notice
that none of the ways succeeds.
Can you try the patch below, which tightens the regexp a bit and tries
to remove these redundant ways to match the same thing?
Stefan
diff --git a/packages/sml-mode/sml-mode.el b/packages/sml-mode/sml-mode.el
index e94b571..f4adf11 100644
--- a/packages/sml-mode/sml-mode.el
+++ b/packages/sml-mode/sml-mode.el
@@ -257,8 +257,8 @@ notion of \"the end of an outline\".")
(defconst sml-id-re "\\sw\\(?:\\sw\\|\\s_\\)*"))
(defconst sml-tyvarseq-re
- (concat "\\(?:\\(?:'+" sml-id-re "\\|(\\(?:[,']\\|" sml-id-re
- "\\|\\s-\\)+)\\)\\s-+\\)?"))
+ (concat "\\(?:\\(?:'+" sml-id-re "\\|(\\(?:[,' \t\n]+" sml-id-re
+ "\\)+)\\)\\s-+\\)?"))
;;; Font-lock settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
This bug report was last modified 8 years and 343 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.