Search code examples
emacselisploading

Emacs takes unbelievably long to start


Yesterday, I :q'd Vim to try Emacs for a while. I've started using Elisp (which is a hundred times better than VimScript), but even when I first installed it (via yum), and had changed nothing, it took about 30 seconds to start, and still does (both GUI and -nw).

I checked the *Messages* buffer:

Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...done

The files seem to be specific to the RPM package I installed. I tried changing their names, yet there was no difference. It still takes 30 seconds.

I've solved it partially by never exiting emacs (I only suspend it) and trying to do everything in it, but it would be nice to occasionally open two Emacs's, especially since I have a tendency to use my terminal emulator's split function rather than something like tmux.

I realized that Emacs would load slower than Vim, but this seems ridiculous for a fresh install. Has anybody got any idea what's going on?

Thanks!


Solution

  • Emacs's PROBLEM file says:

    *** Emacs startup on GNU/Linux systems (and possibly other systems) is slow.
    
    This can happen if the system is misconfigured and Emacs can't get the
    full qualified domain name, FQDN.  You should have your FQDN in the
    /etc/hosts file, something like this:
    
    127.0.0.1   localhost
    129.187.137.82  nuc04.t30.physik.tu-muenchen.de nuc04
    
    The way to set this up may vary on non-GNU systems.
    

    This "slow startup" typically comes from a timeout, and 30s sounds about right.

    As a side note: the DNS lookup that causes this slow down was considered important/useful back in the days where (almost) all machines had a static IP address. Nowadays the info gathered this way does not justify the effort, so starting with Emacs-25, Emacs does not perform this DNS lookup, so this problem should simply not exist any more.