Rens Oliemans <ha...@rensoliemans.nl> writes: > When I open an org file before opening the agenda, my habits show up as > regular tasks, > rather than with the consistency graph. Additionally, many CANCELed tasks > still show up in > the agenda. When I open the agenda first however, everything goes fine. > > Interestingly, this only happens when I bind 'org-agenda' to a key. To show > this, I have > attached bad.el and good.el which reproduce the issue on current main (Org > mode version > 9.7-pre (release_9.6.21-1295-g46909a @ /opt/org-mode/lisp/)). > ... > (use-package org-agenda > :ensure nil > :load-path "/opt/org-mode/lisp" > :config > (add-to-list 'org-modules 'org-habit t) > (setq org-agenda-files '("file.org")) > > :bind (("C-c a" . org-agenda)))
:bind keyword in use-package defers execution of the config snippet. So, with :bind, you first have the (use-package org ...) executed, loading org.el, and only later, after you press C-c a, :config block in (use-package org-agenda ...) is executed and `org-modules' is changed. If you check the docstring for `org-modules', you will see "Modules that should always be loaded together with org.el." However, your config block is executed _after_ org.el is loaded. So, changes to that variable have 0 effect and org-habit.el is not loaded. You should set `org-modules' _before_ loading Org. Or you can load org-habit in more traditional way, via (require 'org-habit) or (use-package org-habit). -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>