From: Leo Liu <sdl.web@gmail.com>
To: 33939@debbugs.gnu.org
Subject: bug#33939: 26.1; Avoid loading libs eagerly or unnecessarily in mhtml-mode/sgml-mode
Date: Tue, 01 Jan 2019 10:12:05 +0800 [thread overview]
Message-ID: <m1bm51nn2i.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mhtml.diff --]
[-- Type: text/x-patch, Size: 1955 bytes --]
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)))))
next reply other threads:[~2019-01-01 2:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-01 2:12 Leo Liu [this message]
2019-01-05 9:47 ` bug#33939: 26.1; Avoid loading libs eagerly or unnecessarily in mhtml-mode/sgml-mode Eli Zaretskii
2019-01-06 4:34 ` Leo Liu
2019-01-06 15:25 ` Eli Zaretskii
2019-01-06 23:39 ` Leo Liu
2019-01-07 0:33 ` Leo Liu
2019-01-07 3:37 ` Eli Zaretskii
2019-01-07 4:16 ` Leo Liu
2019-01-07 19:56 ` Eli Zaretskii
2019-01-07 21:20 ` Leo Liu
2019-01-07 22:43 ` Leo Liu
2019-01-08 3:31 ` Eli Zaretskii
2019-01-08 4:40 ` Leo Liu
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1bm51nn2i.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=33939@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).