all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 24205@debbugs.gnu.org
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	[thread overview]
Message-ID: <jwv1t1v9cuh.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAFyQvY3cWRTm7g_bjja6RQ+6H5Tvfw9YgLjAi99YEZ3kYmMZZw@mail.gmail.com> (Kaushal Modi's message of "Thu, 11 Aug 2016 21:15:52 +0000")

>  (* ''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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 





  reply	other threads:[~2016-08-11 22:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 17:03 bug#24205: 25.1.50; Re-display issue (lag) when opening certain files [sml-mode] Kaushal Modi
2016-08-11 17:22 ` Eli Zaretskii
2016-08-11 17:30   ` Kaushal Modi
2016-08-11 17:45     ` Kaushal Modi
2016-08-11 18:19       ` Stefan Monnier
2016-08-11 19:42     ` Eli Zaretskii
2016-08-11 19:53       ` Kaushal Modi
2016-08-11 20:27         ` Eli Zaretskii
2016-08-11 20:58           ` Andreas Schwab
2016-08-11 21:15           ` Kaushal Modi
2016-08-11 22:21             ` Stefan Monnier [this message]
2016-08-14 13:26               ` Stefan Monnier
2016-08-14 23:14                 ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv1t1v9cuh.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=24205@debbugs.gnu.org \
    --cc=kaushal.modi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.