Emacs Init File Errors

by Joshua Branson — May 13, 2018

This morning, I was rummaging through my emacs init files, and I was noticing that as emacs started up, it seemed to be opening a lot of files.

"Hmmm, am I using desktop-save-mode?"  I wondered.

Desktop-save-mode is an emacs mode that saves your emacs session.  It remembers, which files you had opened, point's location in the files, etc.   When you open emacs again, emacs opens just the way you had it the last time. It can be kind of nice, but it can also make emacs slow to start.

So I was noticing that when I started emacs, it was taking opening a ton of files, and wasting a lot of time doing so.  So I looked through my init file and found that I was NOT using desktop-save-mode.  So something else was causing this.

I had to find the error the hard way: I commented more than half of my init file. Then I shut down emacs.  Restarted.  Then I un-commented out one line.  Shut off emacs restarted. Repeat.  I finally found the culprit: (add-hook 'after-init-hook 'org-agenda-list)

Basically after my Emacs load, org-mode is opening lots of files to build the agenda.  It had to open 15 files!  And I only needed two of those files to build the agenda!  So I removed several files from the org-agenda-files variable and that solved the problem.  Onto the next issue with my emacs config files!