emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Rens Oliemans <hallo@rensoliemans.nl>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Possible bug in org-agenda not showing habits properly
Date: Tue, 19 Mar 2024 14:56:22 +0000	[thread overview]
Message-ID: <87jzlyw9rd.fsf@localhost> (raw)
In-Reply-To: <87sf0nu6fp.fsf@rensoliemans.nl>

Rens Oliemans <hallo@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>


  reply	other threads:[~2024-03-19 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 11:26 Possible bug in org-agenda not showing habits properly Rens Oliemans
2024-03-19 14:56 ` Ihor Radchenko [this message]
2024-03-20 11:20   ` Rens Oliemans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzlyw9rd.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=hallo@rensoliemans.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).