Subject: Re: 25.1.50; Re-display issue (lag) when opening certain files [sml-mode]

From: Kaushal Modi <[email-masked]>
Date: Thu, 11 Aug 2016 19:53:05 +0000

On Thu, Aug 11, 2016 at 3:42 PM Eli Zaretskii <[email-masked]> wrote:

> It would help immensely.  Unless visiting the file is all that's
> needed, see below.
>

Correct, visiting the file is all that's needed, with the correct major
mode turning on.
That's why the file name ends in .sml and I made my MWE install the
sml-mode package from GNU Elpa so that that mode is autoloaded on visiting
any .sml file.

To clarify, this issue does not occur for ANY .sml file. It happens to
occur only due to this example file:

The file has to contain just this sml comment:

=====
(* ''a is a special equality type (it is not the same as the generic 'a
type. It *)
=====

I cannot figure out what's special about this comment that freaks the
re-display.

Are you saying that just visiting this file exhibits the problem?

Yes, in sml-mode.

> If
> so, what modes should be turned on in the visiting buffer to see the
> problem?
>

All my MWE is doing is:
- Install sml-mode from GNU Elpa
- Create a specific example file that causes this issue
- Start profiler
- Visit the file

You will then see a 10-20 second lag.

After which you hit C-c r (that shows the profiler report and also resets
the profiler. My MWE sets that binding.).

Here's the MWE once again:

=====
(emacs-pkg-debug-setup
    '((nil . (sml-mode))) ; Install sml-mode from GNU Elpa
  (let ((test-file (expand-file-name
                    "lag_test.sml"
                    user-emacs-directory)))
    ;; The `emacs-pkg-debug-setup' macro sets user-emacs-directory to
    ;; (concat temporary-file-directory (getenv "USER") "/"
".emacs.d-debug/")
    (defun my-report ()
      (interactive)
      (profiler-report)
      (profiler-stop)
      (profiler-reset))
    (global-set-key (kbd "C-c r") #'my-report)

    (with-temp-buffer
      (insert (concat "(* ''a is a special equality type (it is not "
                      "the same as the generic 'a type. It *)"))
      (write-file test-file))
    (profiler-start 'cpu)
    (find-file test-file)))
=====
-- 

Kaushal Modi