Subject: Re: bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el

From: Juanma Barranquero <[email-masked]>
Date: Sun, 30 Aug 2009 22:45:03 +0200

On Sun, Aug 30, 2009 at 22:04, Stefan Monnier<[email-masked]> wrote:

> Sorry, too ugly to be worth the few bytes (especially since these are
> bytes you'll be using anyway as soon as you start Emacs).

I've often wondered why there is no `after-load-hook' or
`after-load-functions', run directly from (the end of) Fload. Then we
could do now

--- loadup.el	21 Aug 2009 06:19:28 -0000	1.180
+++ loadup.el	30 Aug 2009 20:44:10 -0000
@@ -57,4 +57,5 @@
 (setq buffer-undo-list t)

+(add-hook 'after-load-hook 'garbage-collect)
 (load "emacs-lisp/byte-run")
 (load "emacs-lisp/backquote")
@@ -286,4 +287,5 @@
 (load "site-init" t)
 (setq current-load-list nil)
+(remove-hook 'after-load-hook 'garbage-collect)

 ;; Write the value of load-history into fns-VERSION.el,

which is not so easy or elegant with `after-load-alist' (whose
regexp-matching functionality is implemented in elisp, AFAICS).

    Juanma