emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#33939: closed (26.1; Avoid loading libs eagerly or


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#33939: closed (26.1; Avoid loading libs eagerly or unnecessarily in mhtml-mode/sgml-mode)
Date: Sun, 06 Jan 2019 23:40:02 +0000

Your message dated Mon, 07 Jan 2019 07:39:11 +0800
with message-id <address@hidden>
and subject line Re: bug#33939: 26.1; Avoid loading libs eagerly or 
unnecessarily in mhtml-mode/sgml-mode
has caused the debbugs.gnu.org bug report #33939,
regarding 26.1; Avoid loading libs eagerly or unnecessarily in 
mhtml-mode/sgml-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
33939: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33939
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 26.1; Avoid loading libs eagerly or unnecessarily in mhtml-mode/sgml-mode Date: Tue, 01 Jan 2019 10:12:05 +0800
Switching from html-mode I have noticed mhtml-mode can take a second or
two (unpleasant noticeable delay) to load on my 2013 macbook air. The
following is a small patch that alleviate the problem. Is it safe for
emacs-26?

diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index b99f7881..2ad3c8eb 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -21,13 +21,9 @@
 
 ;;; Code:
 
-(eval-and-compile
-  (require 'flyspell)
-  (require 'sgml-mode))
+(eval-and-compile (require 'sgml-mode))
 (require 'js)
 (require 'css-mode)
-(require 'prog-mode)
-(require 'font-lock)
 
 (defcustom mhtml-tag-relative-indent t
   "How <script> and <style> bodies are indented relative to the tag.
@@ -349,6 +345,8 @@ This is used by `mhtml--pre-command'.")
       ;; HTML.
       (sgml-indent-line))))
 
+(declare-function flyspell-generic-progmode-verify "flyspell")
+
 (defun mhtml--flyspell-check-word ()
   (let ((submode (get-text-property (point) 'mhtml-submode)))
     (if submode
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index eb6ebf52..ad3357e0 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -33,10 +33,9 @@
 ;;; Code:
 
 (require 'dom)
-(require 'seq)
-(eval-when-compile (require 'subr-x))
 (eval-when-compile
   (require 'skeleton)
+  (require 'subr-x)
   (require 'cl-lib))
 
 (defgroup sgml nil
@@ -2240,7 +2239,7 @@ The result is cached in `html--buffer-classes-cache'."
         (cdr html--buffer-classes-cache)
       (let* ((dom (libxml-parse-html-region (point-min) (point-max)))
              (classes
-              (seq-mapcat
+              (mapcan
                (lambda (el)
                  (when-let* ((class-list
                               (cdr (assq 'class (dom-attributes el)))))
@@ -2258,7 +2257,7 @@ The result is cached in `html--buffer-ids-cache'."
       (let* ((dom
               (libxml-parse-html-region (point-min) (point-max)))
              (ids
-              (seq-mapcat
+              (mapcan
                (lambda (el)
                  (when-let* ((id-list
                               (cdr (assq 'id (dom-attributes el)))))

--- End Message ---
--- Begin Message --- Subject: Re: bug#33939: 26.1; Avoid loading libs eagerly or unnecessarily in mhtml-mode/sgml-mode Date: Mon, 07 Jan 2019 07:39:11 +0800 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (macOS 10.14.2)
Fixed in 26.2.

On 2019-01-06 17:25 +0200, Eli Zaretskii wrote:
> OK.  Would you be okay with doing only the first of these,
> i.e. avoiding to load flyspell, on the emacs-26 branch?  Or is the use
> of seq.el still slowing down the load significantly?

Sounds good. I just did that which shaves off ~100ms.

(require 'mhtml-mode) takes ~1.5 seconds on my machine. I think the bulk
of the time is spent loading js.el which loads cc-mode but delay loading
js is trickier so I'll leave it off for now.

Thanks for reviewing the bug.

Leo


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]