Normally GNU Emacs loads pretty quickly for me on startup (0.88 seconds); however, if I load w3m, it takes a whopping 19.42 seconds to load. I set debug-on-quit
to t
so I could interrupt w3m while it hangs. I did this from a vanilla GNU Emacs 27.1 (stable) version, and I saw a huge byte code for defvar w3m-content-type-alist
that Emacs was trying to evaluate.
I grepped the source code for it and got this: w3m.el:1061:(defvar w3m-content-type-alist
. When I went directly to that line and evaluated it, sure enough: It took ~20 seconds to load. My mailcap file is big, though (888 lines), so this lag time affects me a lot.
This bug was also experienced on the main branch about a year ago: emacs-w3m#73. Can you implement the same fix that they made to improve how the mailcap file is parsed and hence optimize the startup time?