Add: (org-quotes.org) Quote from /u/8ninjani8 on /r/emacs
[worg.git] / agenda-optimization.org
blob5f97ebedeb7797ed88c347bdf16154f629447e32
1 #+TITLE: Agenda speedup and optimization
2 #+AUTHOR: Bastien Guerry
3 #+STARTUP:    align fold nodlcheck hidestars oddeven
4 #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
5 #+LANGUAGE:   en
6 #+CATEGORY:   worg
7 #+OPTIONS:    H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
8 #+LINK:       doc https://orgmode.org/worg/doc.html#%s
10 When your Org files grow, agenda generation may slow down.
12 Here are some tips on how to speed up the agenda generation.  For those
13 tips that depend on a specific version of Org, we mention this version.
15 #+INDEX: Agenda speedup
17 * Reduce the number of Org agenda files
19 The more agenda files, the more time it takes to check all of them before
20 producing an agenda command.  The older your hardrive is, the longer it
21 takes to visit a file.  Don't buy a new harddrive now!  Just reduce the
22 number of agenda files.
24 Also, don't forget that you can define the set of agenda files for each
25 agenda custom command like this:
27 #+BEGIN_SRC emacs-lisp
28   (setq org-agenda-custom-commands
29         '((" " "Aujourd'hui" agenda "List of rendez-vous and tasks for today"
30            ((org-agenda-files '("~/org/rdv.org" "~/org/bzg.org"))))))
31 #+END_SRC
33 * Reduce the number of DONE and archived headlines
35 When matching against TODO-type tasks, Org will skip the ones marked as
36 DONE or archived.  If you have many DONE tasks and archived tasks in your
37 file, better to store them in another file.
39 * Inhibit the dimming of blocked tasks
41 #+INDEX: Dim blocked tasks
42 #+INDEX: org-agenda-dim-blocked-tasks
44 By default [[doc::org-agenda-dim-blocked-tasks][org-agenda-dim-blocked-tasks]] is set to t, which will dim blocked
45 tasks.  For the agenda to get the relevant information, it needs to check
46 against the headline up, and this takes time.  If you don't need this
47 feature globally or for a specific agenda, turning it off will speed up
48 agenda generation.
50 * Inhibit agenda files startup options (Org > 8.0)
52 #+INDEX: org-startup-folded
54 When you run an agenda command, Org visits agenda files that are not yet
55 visited.  When finding a file for the first time, Org checks the startup
56 options and apply them to the buffer: those options are either globally set
57 through the =org-startup-*= variables or on a per-file basis through the
58 =#+STARTUP= keyword.
60 Especially, Org will honor the startup visibility status, as set by
61 [[doc::org-startup-folded][org-startup-folded]] or =#+STARTUP: folded=.
63 This may slow down the operation of visiting a file very much, and the
64 process of selecting agenda entries consequently.
66 To prevent agenda commands to honor startup options when visiting an agenda
67 file for the first time, use this:
69 #+BEGIN_SRC emacs-lisp
70   (setq org-agenda-inhibit-startup t)
71 #+END_SRC
73 The side-effect is that newly visited file will have all their headlines
74 visible, but this speeds up agenda generation /a lot/ when those files have
75 many nested headlines.
77 * Disable tag inheritance in agendas (Org > 8.0)
79 #+INDEX: Tag inheritance
80 #+INDEX: org-use-tag-inheritance
81 #+INDEX: org-agenda-use-tag-inheritance
82 #+INDEX: org-agenda-show-inherited-tags
84 Defining inherited tags for a headline in the agenda takes time, because
85 Org needs will grab inherited tags from higher level headlines.
87 Whether the agenda knows about inherited tags for each task depends on
88 [[doc::org-use-tag-inheritance][org-use-tag-inheritance]] and [[doc::org-agenda-use-tag-inheritance][org-agenda-use-tag-inheritance]]:
90 - [[doc::org-use-tag-inheritance][org-use-tag-inheritance]] controls whether tags are inherited for tags-type
91   agenda commands: =tags=, =tags-todo= and =tags-tree=.  This variable also
92   controls whether tags are inherited when running the command =M-x
93   org-sparse-tree RET= in an Org buffer (hence the name of this variable,
94   without the =org-agenda-= prefix.)
96 - [[doc::org-agenda-use-tag-inheritance][org-agenda-use-tag-inheritance]] controls whether tags are inherited for
97   other agenda types too: =todo=, =search=, =timeline=, =agenda=.
99   Generally, you want this variable to be nil, because the headlines on
100   those agenda types don't depend on tags (and /a fortiori/ on inherited
101   ones.)  Still, the default is to use tags in all agenda types, because
102   [[doc::org-agenda-show-inherited-tags][org-agenda-show-inherited-tags]] needs to do the right thing by default.
104 What to do?  If you don't need inherited tags in
105 todo/search/timeline/agenda, just use this setting:
107 #+BEGIN_SRC emacs-lisp
108   (setq org-agenda-use-tag-inheritance nil)
109 #+END_SRC
111 If you need tags in todo agendas only:
113 #+BEGIN_SRC emacs-lisp
114   (setq org-agenda-use-tag-inheritance '(search timeline agenda))
115 #+END_SRC
117 You can also set this on a per-command basis:
119 #+BEGIN_SRC emacs-lisp
120   (setq org-agenda-custom-commands
121         '((" " "Aujourd'hui" agenda "List of rendez-vous and tasks for today"
122            ((org-agenda-files '("~/org/rdv.org" "~/org/bzg.org"))
123             (org-agenda-use-tag-inheritance nil)))))
124 #+END_SRC
126 * Disable parsing for some drawer properties
128 Text properties are used to prepare buffers for effort estimates,
129 appointments, and subtree-local categories in the agenda.  If you
130 don't use some of these agenda features, you can turn them off.
131 Since using such drawer properties require a special scan before each
132 new agenda command, this can lead to a speedup. For example
134 #+BEGIN_SRC emacs-lisp
135   (setq org-agenda-ignore-drawer-properties '(effort appt category))
136 #+END_SRC