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

w3m-load.el byte compile



This is an idea to byte compile w3m-load.el, so that its docstrings are
not loaded into memory unless or until they're viewed (which may be
never).

I suspect generate-file-autoloads puts no-byte-compile for the benefit
of emacs' own loaddefs which are dumped and therefore don't need byte
compiling.  For everyone else byte compiling saves some memory on medium
to large docstrings.

2013-08-13  Kevin Ryde  <user42@xxxxxxxxxx>

	* w3mhack.el (w3mhack-module-list): Remove w3mhack-load-file from the
	modules not to be byte compiled, so that it is byte compiled.
	(w3mhack-generate-load-file): Remove no-byte-compile from w3m-load.el.
--- w3mhack.el.~1.176.~	2013-08-13 11:20:15.000000000 +1000
+++ w3mhack.el	2013-08-13 11:29:54.000000000 +1000
@@ -289,7 +289,7 @@
 	 (version-specific-modules '("w3m-ems.el" "w3m-xmas.el"))
 	 (ignores;; modules not to be byte-compiled.
 	  (append
-	   (list "w3mhack.el" "w3m-setup.el" w3mhack-load-file)
+	   (list "w3mhack.el" "w3m-setup.el")
 	   (delete (if (featurep 'xemacs) "w3m-xmas.el" "w3m-ems.el")
 		   (copy-sequence version-specific-modules))))
 	 (shimbun-dir (file-name-as-directory shimbun-module-directory))
@@ -979,6 +979,14 @@
 	  (goto-char (point-max))
 	  (insert (if (featurep 'xemacs) "\C-l\n" "")
 		  ";;; " w3mhack-load-file " ends here\n"))
+
+        ;; Delete "no-byte-compile" so that w3m-load.el will byte compile.
+        ;; Byte compiling gives dynamic docstrings which means they aren't
+        ;; loaded into memory unless or until required.
+        (goto-char (point-min))
+        (when (re-search-forward "^;; no-byte-compile: t\n" nil t)
+          (delete-region (match-beginning 0) (match-end 0)))
+
 	(save-buffer)))))
 
 (defun w3mhack-generate-xemacs-load-file (file)