Emacs runs incredibly long

Yesterday, I :q Vim to try Emacs for a while. I started using Elisp (which is a hundred times better than VimScript), but even when I first installed it (via yum ) and didn’t change anything, it took about 30 seconds to start and still (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 specific to the RPM package that I installed. I tried to change their names, but there was no difference. It takes another 30 seconds.

I solved it partially, never leaving emacs (I just pause it) and try to do everything in it, but it would be nice to open two Emacs sometimes, especially since I tend to use my terminal emulator and not something like tmux .

I realized that Emacs will load slower than Vim, but that seems ridiculous for a new installation. Has anyone understood what is going on?

Thanks!

+7
emacs elisp loading
source share
3 answers

The Emacs 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 start” usually comes from a timeout, and 30 seconds sounds right.

As a side note: finding the DNS that causes this slowdown was considered important / useful in those days when (almost) all machines had a static IP address. Currently, the information collected in this way is not worth the effort, therefore, starting with Emacs-25, Emacs does not perform this DNS lookup, so this problem simply should not be anymore.

+11
source share

Well, I have a (bizarre and temporary) solution. I need to run dhclient em1 to access the Internet, which causes Emacs to load for 30 seconds, possibly due to some timeout. So, having already dhclient em1 , I use the shell script to run Emacs, which does the following:

 sudo pkill dhclient sudo ifconfig em1 down emacs -nw -daemon 2> /dev/null sudo ifconfig em1 up sudo dhclient em1 

This disables network connectivity, starts Emacs as a daemon, and reconnects to the network. This is ugly, but it works now. If anyone has a better answer, I would be glad to hear that. Of course, em1 would have to be replaced with your Ethernet device (maybe eth0 , I think).

+1
source share

I had a familiar problem with emacs, taking about 15 seconds to run. In my case, the reason was a DNS timeout. For some reason, with my DNS server, a failed reverse lookup (host 127.0.0.1) takes about 10 seconds. Replacing the DNS server with the google name server (8.8.8.8) gives an almost instant answer "not found: 3 (NXDOMAIN)". At the same time, emacs startup time was reduced to less than 2 seconds. Thanks to @Stefan for pointing me towards DNS issues.

Edit: adding the google name server as an additional NS in Network Manager also does the job. (i.e. when your resolv.conf has NS in this order:

 nameserver abcd nameserver 8.8.8.8 

)

+1
source share

All Articles