abo-abo / oremacs

My Emacs config
https://oremacs.com/
296 stars 33 forks source link

FYI and thanks #19

Closed hhnr closed 6 years ago

hhnr commented 6 years ago

Hi,

Thank you for sharing your configuration, elisp libraries and over all contribution to emacs. I have cloned your emacs configuration and emacs starts under a second. How do you manage to keep the emacs init time very low? I use use-package macro and for me emacs takes few seconds to startup. Can you share some pointers or write up a blog post on how you make emacs startup fast?

Thanks

abo-abo commented 6 years ago

Thank you for sharing your configuration, elisp libraries and over all contribution to emacs.

You're welcome.

I have cloned your emacs configuration and emacs starts under a second. How do you manage to keep the emacs init time very low? I use use-package macro and for me emacs takes few seconds to startup.

A lot of stuff is autoloaded. See hooks.el - it contains 72 add-hook statements. The functions in add-hook are usually defined in their own file, which is related to the corresponding major-mode. So instead of loading ~72 files and all dependencies that they pull in, I load only 72 add-hook statements that are instant because they don't load any packages. Then when e.g. python-mode is opened:

  1. It calls python-mode-hook,
  2. which calls ora-python-hook,
  3. which is autoloaded from ora-python.el,
  4. which means that the whole content of ora-python.el is loaded only when the first python-mode file is opened.

See also update-all-autoloads, which generates the loaddefs.el file.

Can you share some pointers or write up a blog post on how you make emacs startup fast?

I thought that I already had written that subject, but I can't find it now. If I don't find it, I'll make a blog post when I have time.

hhnr commented 6 years ago

That's interesting. I think spacemacs also does something similar? It installs python mode specific packages only when the first python mode file is opened. I will look into the your configuration. Looking forward to your blog post!

Thanks.