[Top][All Lists]

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

Re: About early-init right use.

From: Ergus
Subject: Re: About early-init right use.
Date: Tue, 2 Apr 2019 18:55:22 +0200
User-agent: NeoMutt/20180716

I know the manual is pretty nice, but some good examples for the "things
to put before the GUIs get initialized" is not a bad idea.
I mixed some things I found here and there and mixed everything to
optimize the startup time (as an experiment)

(defconst my/start-time (current-time))

(defvar file-name-handler-alist-old file-name-handler-alist)

(setq file-name-handler-alist nil
     message-log-max 16384
     gc-cons-threshold most-positive-fixnum   ;; Defer Garbage collection
     gc-cons-percentage 1.0)

(add-hook 'emacs-startup-hook
         `(lambda ()
            (setq file-name-handler-alist file-name-handler-alist-old
                  gc-cons-threshold 800000
                  gc-cons-percentage 0.1)
                         (message "Load time %.06f"
                                          (float-time (time-since 
my/start-time)))) t)

(tool-bar-mode   -1)
(menu-bar-mode   -1)
(scroll-bar-mode -1)
(tooltip-mode    -1)                    ;; Tool tip in the echo
(flymake-mode    -1)

;; For using Melpa and Elpa
(setq package-archives '(("gnu" . "";)
                                                 ("melpa" . 

(setq package-quickstart t)

;;-------------------- Some tricks--------------------------
(provide 'early-init)
;;; early-init.el ends here


In fact this, mixed with the use-package :bind :commands and so on
reduced my loading time from ~2 to ~0.9 seconds.

But I think this is a little bit too much for the early init and some of
the options doesn't really produce any improvement, so they should go in
the init.el

But I wanted to have a "stronger" argument about what to put and what

On Tue, Apr 02, 2019 at 05:42:22PM +0200, wrote:
On Tue, Apr 02, 2019 at 07:21:30AM -0700, Drew Adams wrote:
> from the 27.0.50 manual (Node "Customization > Init File >
> Early Init File"):
>     This file is loaded before the
>     package system and GUI is initialized, so in it you can customize
>     variables that affect frame appearance as well as the package
>     initialization process...
>     the early init file is read before the GUI is initialized,
>     so customizations related to GUI features will not work reliably
>     in ‘early-init.el’.

Seems a bit contradictory wrt "variables that affect frame
appearance".  What variables are we talking about, if they
are not "related to GUI features"?

Hm. I read it differently: putting things in early-init.el gives you
the chance to do things /before/ GUI and frame-appearance things are
initialized. Thus it gives you the power to fix things, but also
to break things.

Put it another way: you almost never want to put anything into
early-init.el -- unless you have the hunch that you need to change
something before GUIs get initialized (e.g. to let them "see" a
different variable value).

Or more TL;DR you better know why you are in there ;-D

-- tomás

reply via email to

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