Skip to content

Commit

Permalink
Add .nosearch to modes/ to not litter subdirs.el
Browse files Browse the repository at this point in the history
If you install evil-collection to site-lisp/, it's getting picked by
Emacs and added to `subdirs.el` in order to populate the `load-path`
at startup. To quote the official documentation:

> For each directory in load-path, Emacs then checks to see if it contains
> a file subdirs.el, and if so, loads it. The subdirs.el file is created when
> Emacs is built/installed, and contains code that causes Emacs to add any
> subdirectories of those directories to load-path. Both immediate subdirectories
> and subdirectories multiple levels down are added. But it excludes subdirectories
> whose names do not start with a letter or digit, and subdirectories named RCS
> or CVS, and subdirectories containing a file named .nosearch.

There are legitimate reasons why one may add evil-collection to
site-lisp/: Linux distributions packaging it as native distro packages
may lead to this for example.

In my case, I'm using Nix and "Emacs Overlay", which is more or less a
standard way to manage Emacs and its configuration under Nix. I've
noticed that my Emacs starts slower than needed (0.6 seconds with
configuration under Nix, and 0.2 seconds with configuration not managed
by Nix). I've pin-pointed the issue to an explosion of `load-path`,
which is one of the biggest performance hogs on Emacs startup.

It seems that:

- Many other packages add `.nosearch` to their subdirs to prevent
  automatic addition to load-path
- There is no risk in introducing this to evil-collection, as it loads
  modules by absolute paths from the basedir of the main file.

I've patched evil-collection and on my system it keeps working, while
achieving a nice load speedup (almost 0.4 seconds). Please consider
merging this.
  • Loading branch information
knazarov authored and jojojames committed May 23, 2024
1 parent 5209902 commit b34369c
Showing 1 changed file with 0 additions and 0 deletions.
Empty file added modes/.nosearch
Empty file.

0 comments on commit b34369c

Please sign in to comment.