From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#24205: 25.1.50; Re-display issue (lag) when opening certain files [sml-mode] Date: Thu, 11 Aug 2016 18:21:59 -0400 Message-ID: References: <837fbnfcg2.fsf@gnu.org> <8360r7f5y8.fsf@gnu.org> <83twerdp9z.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1470954034 4596 195.159.176.226 (11 Aug 2016 22:20:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2016 22:20:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: 24205@debbugs.gnu.org To: Kaushal Modi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 12 00:20:31 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXyL0-00015z-TD for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Aug 2016 00:20:31 +0200 Original-Received: from localhost ([::1]:50720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXyKx-00027b-Uy for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Aug 2016 18:20:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXyKd-0001uW-Gu for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 18:20:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXyKY-00081b-DM for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 18:20:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXyKY-00081R-AJ for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 18:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bXyKY-0001pm-1R for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 18:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Aug 2016 22:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24205 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24205-submit@debbugs.gnu.org id=B24205.14709539616985 (code B ref 24205); Thu, 11 Aug 2016 22:20:01 +0000 Original-Received: (at 24205) by debbugs.gnu.org; 11 Aug 2016 22:19:21 +0000 Original-Received: from localhost ([127.0.0.1]:54470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXyJs-0001oa-Mm for submit@debbugs.gnu.org; Thu, 11 Aug 2016 18:19:20 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:59498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXyJr-0001oT-7P for 24205@debbugs.gnu.org; Thu, 11 Aug 2016 18:19:19 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id u7BMJHj9020223; Thu, 11 Aug 2016 18:19:17 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id D700D66171; Thu, 11 Aug 2016 18:21:59 -0400 (EDT) In-Reply-To: (Kaushal Modi's message of "Thu, 11 Aug 2016 21:15:52 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5763=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5763> : inlines <5085> : streams <1682595> : uri <2265123> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122114 Archived-At: > (* ''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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;