Below code easily recreates the issue on emacs -Q on the latest master build of emacs as of now (2e0a2b3).
Please evaluate the macro definition and the macro call form below.
In short, this will install the sml-mode package from GNU Elpa to the temporary-file-directory for your system, and also generate a test .sml file that happened to show this issue. I do not see this lag on opening other .sml files. For some reason, this .sml file (that the below example creates) has ONLY comments and that causes emacs to stall for 10's of seconds.
After evaluating the code below, you should (too, hopefully) see emacs stall for 10-20 seconds. All it was doing was opening this file:
(* ''a is a special equality type (it is not the same as the generic 'a type. It *)
(* means that both arguments can be of any type as long as you can use the *)
(* equality operation between them. So both can be int, both can be strings, *)
(* both can be int tuples. TH*)
After that, on doing M-x profiler-report, I get:
+ redisplay_internal (C function) 14724 99%
+ command-execute 42 0%
+ ... 27 0%
I am copying Eli (for possibly re-display issue) and Stefan (for I have seen for the first and only time in sml-mode).
I have started using sml-mode just recently (2 weeks), and my emacs froze as I was typing out that comment in the test file. So I have no idea if the bug is specific to 25.1/25.2 versions.
(defmacro emacs-pkg-debug-setup (pkg-alist &rest body)
"Install packages in PKG-ALIST and evaluate BODY.
Each element of PKG-ALIST has the form (((ID . LOCATION) . (PKG1 PKG2 ..)) ..).
The ID and LOCATION are the same as the ones in `package-archives'.
PKG1, PKG2, .. are package names from the ID archive.
1. Launch 'emacs -Q'.
2. Copy this macro definition to its scratch buffer and evaluate it.
3. Evaluate a minimum working example using this macro as below:
(emacs-pkg-debug-setup '(;; Install hydra from GNU Elpa
(nil . (hydra))
;; Install org from Org Elpa
;; Then evaluate the below forms
(declare (indent 1) (debug t))
(setq user-emacs-directory (concat temporary-file-directory
(getenv "USER") "/" ".emacs.d-debug/"))
(setq package-user-dir (concat user-emacs-directory "elpa/"))
(let (archive pkgs)
(dolist (archive-alist ,pkg-alist)
(setq archive (car archive-alist))
(add-to-list 'package-archives archive :append))
(setq pkgs (append pkgs (cdr archive-alist))))
(dolist (pkg pkgs)
(when (and pkg (not (package-installed-p pkg)))
(emacs-pkg-debug-setup '(;; Install sml-mode from GNU Elpa
(nil . (sml-mode)))
(let ((test-file (expand-file-name "lag_test.sml" temporary-file-directory)))
"(* ''a is a special equality type (it is not the same as the generic 'a type. It *)\n"
"(* means that both arguments can be of any type as long as you can use the *)\n"
"(* equality operation between them. So both can be int, both can be strings, *)\n"
"(* both can be int tuples. TH*)"))
In GNU Emacs 126.96.36.199 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
of 2016-08-11 built on
Repository revision: 2e0a2b376f51dd515ffeb6449181cc37fe912f5e
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6 (Santiago)
-I/usr/include/freetype2 -I/usr/include' 'CFLAGS=-ggdb3 -O0'
'CXXFLAGS=-ggdb3 -O0' 'LDFLAGS=-L/home/kmodi/usr_local/6/lib
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
Major mode: Profiler-Report
Minor modes in effect:
(shadow sort mail-extr emacsbug sendmail profiler vc-git diff-mode
easy-mmode sml-mode skeleton warnings smie cl compile comint ansi-color
ring autoload radix-tree lisp-mnt cus-edit cus-start cus-load wid-edit
mm-archive message dired dired-loaddefs format-spec rfc822 mml mml-sec
epa derived gnus-util rmail rmail-loaddefs mailabbrev gmm-utils
mailheader mm-decode mm-bodies mm-encode mail-utils network-stream
starttls url-http tls gnutls mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm subr-x puny url-cache url-auth url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap epg finder-inf package epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cl-extra cconv help-mode easymenu cl-loaddefs pcase cl-lib
debug time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
((conses 16 153840 33952)
(symbols 48 25942 2)
(miscs 40 104 407)
(strings 32 35522 6421)
(string-bytes 1 1074371)
(vectors 16 46905)
(vector-slots 8 1777619 18518)
(floats 8 269 573)
(intervals 56 782 163)
(buffers 976 16)
(heap 1024 36043 2798))