11

It takes several seconds for Emacs org-mode to generate my agenda. How can I make it faster? I'm already using archive files, and I have less than 30 .org files, all of them reasonably short.

Partial profiler output of the org-agenda command:

+ ...                                                              93  50%
- command-execute                                                  90  49%
 - call-interactively                                              85  46%
  - org-agenda                                                     80  43%
   - byte-code                                                     80  43%
    - call-interactively                                           79  43%
     - org-agenda-list                                             79  43%
      - byte-code                                                  79  43%
       - org-agenda-prepare                                        68  37%
        - org-agenda-prepare-buffers                               67  36%
         - byte-code                                               67  36%
          - org-get-agenda-file-buffer                             67  36%
           - find-file-noselect                                    67  36%
            - find-file-noselect-1                                 67  36%
             - after-find-file                                     66  36%
              + run-hooks                                          35  19%
              + normal-mode                                        30  16%
              + auto-save-mode                                      1   0%
             + normal-backup-enable-predicate                       1   0%
        + org-agenda-files                                          1   0%
       + byte-code                                                 10   5%
         org-days-to-iso-week                                       1   0%
    + org-agenda-get-restriction-and-command                        1   0%   
  + byte-code                                                       4   2%   
  + minibuffer-complete                                             1   0%
  • It seems org mode wastes a lot of time opening the files. You might see improvements if you just keep these buffers always open. – Malabarba Oct 7 '14 at 22:28
9

I've created this workaround, which pregenerates an agenda buffer whenever Emacs is idle for more than 5 seconds. The next time the agenda command is run, generation takes less than a second, since the org buffers have already been loaded.

(run-with-idle-timer 5 nil (lambda () (org-agenda-list) (delete-window)))
6

Not quite an answer to your question, but consider (setq org-agenda-sticky t). This makes the q command bury the agenda buffer when you've finished with it, rather than close it.

The result of this is that the agenda will reappear immediately when you next ask for it, but it won't have been updated since you last saw it. If you want it updated you can always press g in the agenda to rebuild it properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.